-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove emberjs-build and intrododuce babel 6
This also rolls up ember-metal
- Loading branch information
1 parent
f0ff486
commit c845e80
Showing
95 changed files
with
1,983 additions
and
910 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
/* eslint-env node */ | ||
|
||
const Funnel = require('broccoli-funnel'); | ||
const semver = require('semver'); | ||
|
||
module.exports = function addon(name, project) { | ||
let addon = project.findAddonByName(name); | ||
let tree = addon.treeFor('addon'); | ||
let options = {}; | ||
|
||
if (semver.lt(project.emberCLIVersion(), '2.13.0')) { | ||
options.srcDir = 'modules'; | ||
} | ||
|
||
return new Funnel(tree, options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
/* eslint-env node */ | ||
const Funnel = require('broccoli-funnel'); | ||
|
||
module.exports = function(env) { | ||
let file; | ||
if (env === 'debug') { | ||
file = 'external-helpers-dev.js'; | ||
} else if (env === 'prod') { | ||
file = 'external-helpers-prod.js' | ||
} | ||
|
||
return new Funnel('packages/external-helpers/lib', { | ||
files: [file], | ||
getDestinationPath() { | ||
return 'ember-babel.js'; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
/* eslint-env node */ | ||
|
||
const WriteFile = require('broccoli-file-creator'); | ||
|
||
function defaultExport(moduleExport) { | ||
return `(function (m) { if (typeof module === "object" && module.exports) { module.exports = m } }(requireModule('${moduleExport}').default));\n` | ||
} | ||
|
||
function sideeffects(moduleExport) { | ||
return `requireModule('${moduleExport}')` | ||
} | ||
|
||
function umd(moduleExport) { | ||
return `(function (m) { if (typeof module === "object" && module.exports) { module.exports = m } }(requireModule('${moduleExport}')));\n` | ||
} | ||
|
||
module.exports = function bootstrapModule(moduleExport, type = 'sideeffects') { | ||
let moduleType = { | ||
default: defaultExport, | ||
umd, | ||
sideeffects | ||
} | ||
|
||
return new WriteFile('bootstrap', moduleType[type](moduleExport)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
/* eslint-env node */ | ||
|
||
const concat = require('broccoli-concat'); | ||
|
||
module.exports = function(tree, options) { | ||
let { outputFile, hasBootstrap } = options; | ||
|
||
if (typeof hasBootstrap !== 'boolean') { | ||
hasBootstrap = true; | ||
} | ||
|
||
let footerFiles = []; | ||
|
||
if (hasBootstrap) { | ||
footerFiles = ['bootstrap'] | ||
} | ||
|
||
return concat(tree, { | ||
header: '(function() {', | ||
outputFile: outputFile, | ||
headerFiles: ['license.js', 'loader.js'], | ||
footerFiles: footerFiles, | ||
inputFiles: ['**/*'], | ||
annotation: outputFile, | ||
footer: '}());' | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
/* eslint-env node */ | ||
|
||
function getFeatures(isDebug) { | ||
let features = Object.assign({}, require('../features').features); | ||
let featureName; | ||
|
||
if (process.env.BUILD_TYPE === 'alpha') { | ||
for (featureName in features) { | ||
if (features[featureName] === null) { | ||
features[featureName] = false; | ||
} | ||
} | ||
} | ||
|
||
if (process.env.OVERRIDE_FEATURES) { | ||
var forcedFeatures = process.env.OVERRIDE_FEATURES.split(','); | ||
for (var i = 0; i < forcedFeatures.length; i++) { | ||
featureName = forcedFeatures[i]; | ||
|
||
features[featureName] = true; | ||
} | ||
} | ||
|
||
features['ember-glimmer-allow-backtracking-rerender'] = false; | ||
|
||
if (process.env.ALLOW_BACKTRACKING) { | ||
features['ember-glimmer-allow-backtracking-rerender'] = true; | ||
features['ember-glimmer-detect-backtracking-rerender'] = false; | ||
} | ||
|
||
features['mandatory-setter'] = isDebug; | ||
features['ember-glimmer-detect-backtracking-rerender'] = isDebug; | ||
|
||
return features; | ||
} | ||
|
||
module.exports.RELEASE = getFeatures(false); | ||
module.exports.DEBUG = getFeatures(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-env node */ | ||
"use strict"; | ||
|
||
const path = require('path'); | ||
|
||
module.exports = function findLib(name, libPath) { | ||
let packagePath = path.join(name, 'package'); | ||
let packageRoot = path.dirname(require.resolve(packagePath)); | ||
|
||
libPath = libPath || getLibPath(packagePath); | ||
|
||
return path.resolve(packageRoot, libPath); | ||
}; | ||
|
||
function getLibPath(packagePath) { | ||
let packageJson = require(packagePath); | ||
|
||
return path.dirname(packageJson['module'] || packageJson['main']); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-env node */ | ||
"use strict"; | ||
|
||
const Funnel = require('broccoli-funnel'); | ||
const findLib = require('./find-lib'); | ||
|
||
module.exports = function funnelLib(name) { | ||
|
||
let libPath, options; | ||
if (arguments.length > 2) { | ||
libPath = arguments[1]; | ||
options = arguments[2]; | ||
} else { | ||
options = arguments[1]; | ||
} | ||
|
||
|
||
return new Funnel(findLib(name, libPath), options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
|
||
const Filter = require('broccoli-persistent-filter'); | ||
const { stripIndent } = require('common-tags'); | ||
|
||
GlimmerTemplatePrecompiler.prototype = Object.create(Filter.prototype); | ||
|
||
function GlimmerTemplatePrecompiler (inputTree, options) { | ||
if (!(this instanceof GlimmerTemplatePrecompiler)) { | ||
return new GlimmerTemplatePrecompiler(inputTree, options); | ||
} | ||
|
||
Filter.call(this, inputTree, {}); | ||
|
||
this.inputTree = inputTree; | ||
if (!options.glimmer) { | ||
throw new Error('No glimmer option provided!'); | ||
} | ||
this.precompile = options.glimmer.precompile; | ||
} | ||
|
||
GlimmerTemplatePrecompiler.prototype.extensions = ['hbs']; | ||
GlimmerTemplatePrecompiler.prototype.targetExtension = 'js'; | ||
|
||
GlimmerTemplatePrecompiler.prototype.baseDir = function() { | ||
return __dirname; | ||
}; | ||
|
||
GlimmerTemplatePrecompiler.prototype.processString = function(content, relativePath) { | ||
var compiled = this.precompile(content, { meta: { moduleName: relativePath } }); | ||
return stripIndent` | ||
import template from '../template'; | ||
export default template(${compiled}); | ||
`; | ||
}; | ||
|
||
module.exports = GlimmerTemplatePrecompiler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const ESLint = require('broccoli-lint-eslint'); | ||
|
||
module.exports = function _lint(tree) { | ||
return new ESLint(tree, { | ||
testGenerator: 'qunit' | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const Funnel = require('broccoli-funnel'); | ||
const Uglify = require('broccoli-uglify-js'); | ||
const path = require('path'); | ||
|
||
module.exports = function _minify(tree, name) { | ||
let minified = new Uglify(tree, { | ||
sourceMapConfig: { | ||
enable: false | ||
}, | ||
mangle: true, | ||
compress: { | ||
// this is adversely affects heuristics for IIFE eval | ||
negate_iife: false, | ||
// limit sequences because of memory issues during parsing | ||
sequences: 30 | ||
}, | ||
output: { | ||
// no difference in size | ||
// and much easier to debug | ||
semicolons: false | ||
} | ||
}); | ||
|
||
return new Funnel(minified, { | ||
getDestinationPath(relativePath) { | ||
let ext = path.extname(relativePath); | ||
if (ext === '.map') { | ||
return `${name}.map` | ||
} | ||
return `${name}.js`; | ||
}, | ||
annotation: name | ||
}); | ||
} |
Oops, something went wrong.