Skip to content

Commit

Permalink
Conditionally include deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsawicki committed Apr 3, 2015
1 parent 87fca98 commit 94d4219
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 109 deletions.
216 changes: 109 additions & 107 deletions exports/atom.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TextBuffer = require 'text-buffer'
{Point, Range} = TextBuffer
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
{deprecate} = require 'grim'
{includeDeprecations, deprecate} = require 'grim'

module.exports =
BufferedNodeProcess: require '../src/buffered-node-process'
Expand All @@ -21,109 +21,111 @@ unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
module.exports.Task = require '../src/task'
module.exports.TextEditor = require '../src/text-editor'

{$, $$, $$$, View} = require '../src/space-pen-extensions'

Object.defineProperty module.exports, 'Workspace', get: ->
deprecate """
Requiring `Workspace` from `atom` is no longer supported.
If you need this, please open an issue on
https://github.com/atom/atom/issues/new
And let us know what you are using it for.
"""
require '../src/workspace'

Object.defineProperty module.exports, 'WorkspaceView', get: ->
deprecate """
Requiring `WorkspaceView` from `atom` is no longer supported.
Use `atom.views.getView(atom.workspace)` instead.
"""
require '../src/workspace-view'

Object.defineProperty module.exports, '$', get: ->
deprecate """
Requiring `$` from `atom` is no longer supported.
If you are using `space-pen`, please require `$` from `atom-space-pen-views`. Otherwise require `jquery` instead:
`{$} = require 'atom-space-pen-views'`
or
`$ = require 'jquery'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
Or add `"jquery": "^2"` to your package dependencies.
"""
$

Object.defineProperty module.exports, '$$', get: ->
deprecate """
Requiring `$$` from `atom` is no longer supported.
Please require `atom-space-pen-views` instead:
`{$$} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
$$

Object.defineProperty module.exports, '$$$', get: ->
deprecate """
Requiring `$$$` from `atom` is no longer supported.
Please require `atom-space-pen-views` instead:
`{$$$} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
$$$

Object.defineProperty module.exports, 'View', get: ->
deprecate """
Requiring `View` from `atom` is no longer supported.
Please require `atom-space-pen-views` instead:
`{View} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
View

Object.defineProperty module.exports, 'EditorView', get: ->
deprecate """
Requiring `EditorView` from `atom` is no longer supported.
Please require `TextEditorView` from `atom-space-pen-view` instead:
`{TextEditorView} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
require '../src/text-editor-view'

Object.defineProperty module.exports, 'TextEditorView', get: ->
deprecate """
Requiring `TextEditorView` from `atom` is no longer supported.
Please require `TextEditorView` from `atom-space-pen-view` instead:
`{TextEditorView} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
require '../src/text-editor-view'

Object.defineProperty module.exports, 'ScrollView', get: ->
deprecate """
Requiring `ScrollView` from `atom` is no longer supported.
Please require `ScrollView` from `atom-space-pen-view` instead:
`{ScrollView} = require 'atom-space-pen-views'`
Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
require '../src/scroll-view'

Object.defineProperty module.exports, 'SelectListView', get: ->
deprecate """
Requiring `SelectListView` from `atom` is no longer supported.
Please require `SelectListView` from `atom-space-pen-view` instead:
`{SelectListView} = require 'atom-space-pen-views'`
Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
require '../src/select-list-view'

Object.defineProperty module.exports, 'React', get: ->
deprecate "Please require `react-atom-fork` instead: `React = require 'react-atom-fork'`. Add `\"react-atom-fork\": \"^0.11\"` to your package dependencies."
require 'react-atom-fork'

Object.defineProperty module.exports, 'Reactionary', get: ->
deprecate "Please require `reactionary-atom-fork` instead: `Reactionary = require 'reactionary-atom-fork'`. Add `\"reactionary-atom-fork\": \"^0.9\"` to your package dependencies."
require 'reactionary-atom-fork'

Object.defineProperty module.exports, 'Git', get: ->
deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`"
module.exports.GitRepository
if includeDeprecations
{$, $$, $$$, View} = require '../src/space-pen-extensions'

Object.defineProperty module.exports, 'Workspace', get: ->
deprecate """
Requiring `Workspace` from `atom` is no longer supported.
If you need this, please open an issue on
https://github.com/atom/atom/issues/new
And let us know what you are using it for.
"""
require '../src/workspace'

Object.defineProperty module.exports, 'WorkspaceView', get: ->
deprecate """
Requiring `WorkspaceView` from `atom` is no longer supported.
Use `atom.views.getView(atom.workspace)` instead.
"""
require '../src/workspace-view'

Object.defineProperty module.exports, '$', get: ->
deprecate """
Requiring `$` from `atom` is no longer supported.
If you are using `space-pen`, please require `$` from `atom-space-pen-views`. Otherwise require `jquery` instead:
`{$} = require 'atom-space-pen-views'`
or
`$ = require 'jquery'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
Or add `"jquery": "^2"` to your package dependencies.
"""
$

Object.defineProperty module.exports, '$$', get: ->
deprecate """
Requiring `$$` from `atom` is no longer supported.
Please require `atom-space-pen-views` instead:
`{$$} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
$$

Object.defineProperty module.exports, '$$$', get: ->
deprecate """
Requiring `$$$` from `atom` is no longer supported.
Please require `atom-space-pen-views` instead:
`{$$$} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
$$$

Object.defineProperty module.exports, 'View', get: ->
deprecate """
Requiring `View` from `atom` is no longer supported.
Please require `atom-space-pen-views` instead:
`{View} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
View

Object.defineProperty module.exports, 'EditorView', get: ->
deprecate """
Requiring `EditorView` from `atom` is no longer supported.
Please require `TextEditorView` from `atom-space-pen-view` instead:
`{TextEditorView} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
require '../src/text-editor-view'

Object.defineProperty module.exports, 'TextEditorView', get: ->
deprecate """
Requiring `TextEditorView` from `atom` is no longer supported.
Please require `TextEditorView` from `atom-space-pen-view` instead:
`{TextEditorView} = require 'atom-space-pen-views'`
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
require '../src/text-editor-view'

Object.defineProperty module.exports, 'ScrollView', get: ->
deprecate """
Requiring `ScrollView` from `atom` is no longer supported.
Please require `ScrollView` from `atom-space-pen-view` instead:
`{ScrollView} = require 'atom-space-pen-views'`
Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
require '../src/scroll-view'

Object.defineProperty module.exports, 'SelectListView', get: ->
deprecate """
Requiring `SelectListView` from `atom` is no longer supported.
Please require `SelectListView` from `atom-space-pen-view` instead:
`{SelectListView} = require 'atom-space-pen-views'`
Note that the API has changed slightly! Please read the docs at https://github.com/atom/atom-space-pen-views
Add `"atom-space-pen-views": "^2.0.3"` to your package dependencies.
"""
require '../src/select-list-view'

Object.defineProperty module.exports, 'React', get: ->
deprecate "Please require `react-atom-fork` instead: `React = require 'react-atom-fork'`. Add `\"react-atom-fork\": \"^0.11\"` to your package dependencies."
require 'react-atom-fork'

Object.defineProperty module.exports, 'Reactionary', get: ->
deprecate "Please require `reactionary-atom-fork` instead: `Reactionary = require 'reactionary-atom-fork'`. Add `\"reactionary-atom-fork\": \"^0.9\"` to your package dependencies."
require 'reactionary-atom-fork'

if includeDeprecations
Object.defineProperty module.exports, 'Git', get: ->
deprecate "Please require `GitRepository` instead of `Git`: `{GitRepository} = require 'atom'`"
module.exports.GitRepository
5 changes: 3 additions & 2 deletions src/styles-element.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{Emitter, CompositeDisposable} = require 'event-kit'
{includeDeprecations} = require 'grim'

class StylesElement extends HTMLElement
subscriptions: null
Expand All @@ -18,7 +19,7 @@ class StylesElement extends HTMLElement
@styleElementClonesByOriginalElement = new WeakMap

attachedCallback: ->
if @context is 'atom-text-editor'
if includeDeprecations and @context is 'atom-text-editor'
for styleElement in @children
@upgradeDeprecatedSelectors(styleElement)
@initialize()
Expand Down Expand Up @@ -66,7 +67,7 @@ class StylesElement extends HTMLElement

@insertBefore(styleElementClone, insertBefore)

if @context is 'atom-text-editor'
if includeDeprecations and @context is 'atom-text-editor'
@upgradeDeprecatedSelectors(styleElementClone)

@emitter.emit 'did-add-style-element', styleElementClone
Expand Down

0 comments on commit 94d4219

Please sign in to comment.