wip
Esse commit está contido em:
@@ -0,0 +1,16 @@
|
||||
var wrap = function(cache, filePath, requires) {
|
||||
cache[filePath] = function() {
|
||||
var cacheRequire = function() {
|
||||
var module = {};
|
||||
var exports = {};
|
||||
module.exports = exports;
|
||||
|
||||
var require = function() { return cache[requires[filePath]] };
|
||||
return module.exports;
|
||||
};
|
||||
|
||||
var exports = cacheRequire();
|
||||
cache[filePath] = function() { return exports; };
|
||||
return exports;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
Module = require 'module'
|
||||
path = require 'path'
|
||||
fs = require 'fs-plus'
|
||||
detective = require 'detective'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
{spawn} = require('./task-helpers')(grunt)
|
||||
|
||||
grunt.registerTask 'concat', 'Concatenate compiled .js files', ->
|
||||
appDir = fs.realpathSync(grunt.config.get('atom.appDir'))
|
||||
contentsDir = fs.realpathSync(grunt.config.get('atom.contentsDir'))
|
||||
sourceFolder = path.join(appDir, 'src')
|
||||
|
||||
rendererApiPath = path.resolve(appDir, '..', 'atom', 'renderer', 'api', 'lib')
|
||||
commonApiPath = path.resolve(appDir, '..', 'atom', 'common', 'api', 'lib')
|
||||
|
||||
resolve = (moduleName, parentPath) ->
|
||||
return null if moduleName is 'season'
|
||||
|
||||
if moduleName[0] is '.'
|
||||
moduleName = path.resolve(path.dirname(parentPath), moduleName)
|
||||
try
|
||||
require.resolve(moduleName)
|
||||
catch error
|
||||
moduleName
|
||||
else
|
||||
originalParentPath = parentPath
|
||||
|
||||
# Built-in modules
|
||||
try
|
||||
return moduleName if require.resolve(moduleName) is moduleName
|
||||
|
||||
parentPath = path.dirname(parentPath)
|
||||
loop
|
||||
modulePath = path.join(parentPath, 'node_modules', moduleName)
|
||||
try
|
||||
return require.resolve(modulePath)
|
||||
catch error
|
||||
break if parentPath is contentsDir
|
||||
parentPath = path.resolve(parentPath, '..')
|
||||
|
||||
rendererPath = path.join(rendererApiPath, "#{moduleName}.js")
|
||||
return rendererPath if fs.isFileSync(rendererPath)
|
||||
|
||||
commonPath = path.join(commonApiPath, "#{moduleName}.js")
|
||||
return commonPath if fs.isFileSync(commonPath)
|
||||
|
||||
null
|
||||
|
||||
jsFiles = {}
|
||||
|
||||
loadDependencies = (filePath) ->
|
||||
return unless fs.isAbsolute(filePath)
|
||||
return if path.extname(filePath) in ['.node', '.json']
|
||||
|
||||
filePath = fs.realpathSync(filePath)
|
||||
return if jsFiles[filePath]?
|
||||
|
||||
contents = grunt.file.read(filePath)
|
||||
requires = {}
|
||||
for requireId in detective(contents)
|
||||
if resolvedPath = resolve(requireId, filePath)
|
||||
requires[requireId] = resolvedPath
|
||||
|
||||
# HACK
|
||||
if /less\/lib\/less\/index\.js$/.test(filePath)
|
||||
for treeFile in fs.listSync(path.resolve(filePath, '..', 'tree'), ['.js'])
|
||||
requires["./tree/#{path.basename(treeFile, '.js')}"] ?= fs.realpathSync(treeFile)
|
||||
|
||||
|
||||
jsFiles[filePath] = {contents, requires}
|
||||
loadDependencies(modulePath) for moduleId, modulePath of requires
|
||||
|
||||
loadDependencies(jsPath) for jsPath in fs.listSync(sourceFolder, ['.js'])
|
||||
|
||||
slug = """
|
||||
var __require = require;
|
||||
var __path = __require('path');
|
||||
var cache = {};
|
||||
|
||||
"""
|
||||
|
||||
for filePath, file of jsFiles
|
||||
slug += """
|
||||
|
||||
cache[#{JSON.stringify(filePath)}] = function() {
|
||||
var module = {};
|
||||
var exports = {};
|
||||
module.exports = exports;
|
||||
module.paths = global.module.paths;
|
||||
cache[#{JSON.stringify(filePath)}] = function() { return module.exports; };
|
||||
|
||||
var requires = #{JSON.stringify(file.requires)};
|
||||
var __filename = #{JSON.stringify(filePath)};
|
||||
var __dirname = __path.dirname(__filename);
|
||||
|
||||
var require = function(id) {
|
||||
var filePath = requires[id];
|
||||
if (cache[filePath])
|
||||
return cache[filePath]();
|
||||
else {
|
||||
if (filePath)
|
||||
return __require(filePath);
|
||||
else
|
||||
return __require(id);
|
||||
}
|
||||
};
|
||||
|
||||
require.resolve = function(id) {
|
||||
if (id[0] === '.')
|
||||
return __path.resolve(__dirname, id);
|
||||
else
|
||||
return id;
|
||||
};
|
||||
|
||||
require.extensions = __require.extensions;
|
||||
|
||||
(function() {
|
||||
#{file.contents}
|
||||
}).call(exports);
|
||||
|
||||
return module.exports;
|
||||
};
|
||||
|
||||
"""
|
||||
|
||||
slug += """
|
||||
|
||||
module.exports = cache['/private/var/folders/pc/rkhqcn355510xs2lycjj18140000gn/T/atom-build/Atom.app/Contents/Resources/app/src/window-bootstrap.js'];
|
||||
"""
|
||||
|
||||
grunt.file.write('slug.js', slug)
|
||||
+1
-29
@@ -1,29 +1 @@
|
||||
{Point, Range} = require 'text-buffer'
|
||||
|
||||
module.exports =
|
||||
BufferedNodeProcess: require '../src/buffered-node-process'
|
||||
BufferedProcess: require '../src/buffered-process'
|
||||
Git: require '../src/git'
|
||||
Point: Point
|
||||
Range: Range
|
||||
|
||||
# The following classes can't be used from a Task handler and should therefore
|
||||
# only be exported when not running as a child node process
|
||||
unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
|
||||
{$, $$, $$$, View} = require '../src/space-pen-extensions'
|
||||
|
||||
module.exports.$ = $
|
||||
module.exports.$$ = $$
|
||||
module.exports.$$$ = $$$
|
||||
if atom.config.get('core.useReactMiniEditors')
|
||||
module.exports.EditorView = require '../src/react-editor-view'
|
||||
else
|
||||
module.exports.EditorView = require '../src/editor-view'
|
||||
module.exports.ScrollView = require '../src/scroll-view'
|
||||
module.exports.SelectListView = require '../src/select-list-view'
|
||||
module.exports.Task = require '../src/task'
|
||||
module.exports.View = View
|
||||
module.exports.WorkspaceView = require '../src/workspace-view'
|
||||
module.exports.Workspace = require '../src/workspace'
|
||||
module.exports.React = require 'react-atom-fork'
|
||||
module.exports.Reactionary = require 'reactionary-atom-fork'
|
||||
module.exports = global.atomExports
|
||||
|
||||
+3
-3
@@ -304,11 +304,11 @@ class Atom extends Model
|
||||
@config.setDefaults('editor', require('./editor-view').configDefaults)
|
||||
@keymaps.loadBundledKeymaps()
|
||||
@themes.loadBaseStylesheets()
|
||||
@packages.loadPackages()
|
||||
# @packages.loadPackages()
|
||||
@deserializeEditorWindow()
|
||||
@packages.activate()
|
||||
# @packages.activate()
|
||||
@keymaps.loadUserKeymap()
|
||||
@requireUserInitScript()
|
||||
# @requireUserInitScript()
|
||||
@menu.update()
|
||||
|
||||
$(window).on 'unload', =>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
{Point, Range} = require 'text-buffer'
|
||||
|
||||
module.exports =
|
||||
BufferedNodeProcess: require '../src/buffered-node-process'
|
||||
BufferedProcess: require '../src/buffered-process'
|
||||
Git: require '../src/git'
|
||||
Point: Point
|
||||
Range: Range
|
||||
|
||||
# The following classes can't be used from a Task handler and should therefore
|
||||
# only be exported when not running as a child node process
|
||||
unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
|
||||
{$, $$, $$$, View} = require '../src/space-pen-extensions'
|
||||
|
||||
module.exports.$ = $
|
||||
module.exports.$$ = $$
|
||||
module.exports.$$$ = $$$
|
||||
if atom.config.get('core.useReactMiniEditors')
|
||||
module.exports.EditorView = require '../src/react-editor-view'
|
||||
else
|
||||
module.exports.EditorView = require '../src/editor-view'
|
||||
module.exports.ScrollView = require '../src/scroll-view'
|
||||
module.exports.SelectListView = require '../src/select-list-view'
|
||||
module.exports.Task = require '../src/task'
|
||||
module.exports.View = View
|
||||
module.exports.WorkspaceView = require '../src/workspace-view'
|
||||
module.exports.Workspace = require '../src/workspace'
|
||||
module.exports.React = require 'react-atom-fork'
|
||||
module.exports.Reactionary = require 'reactionary-atom-fork'
|
||||
|
||||
global.atomExports = module.exports
|
||||
@@ -1,4 +1,3 @@
|
||||
# Like sands through the hourglass, so are the days of our lives.
|
||||
startTime = Date.now()
|
||||
|
||||
require './window'
|
||||
@@ -6,6 +5,13 @@ require './window'
|
||||
Atom = require './atom'
|
||||
window.atom = Atom.loadOrCreate('editor')
|
||||
atom.initialize()
|
||||
require('./exports')
|
||||
atom.startEditorWindow()
|
||||
window.atom.loadTime = Date.now() - startTime
|
||||
console.log "Window load time: #{atom.getWindowLoadTime()}ms"
|
||||
|
||||
# s = Date.now()
|
||||
# start = require('../slug2.js')
|
||||
# console.log Date.now() - s
|
||||
# start()
|
||||
# console.log Date.now() - s
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
@import "octicon-utf-codes";
|
||||
@import "octicon-mixins";
|
||||
|
||||
.editor-colors {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.editor.react {
|
||||
.editor-contents {
|
||||
width: 100%;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário