Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX release] rollup step should deactivate ember modules polyfill >= 3.27 #7552

Merged
merged 2 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"command-line-args": "^5.1.1",
"common-tags": "^1.8.0",
"debug": "^4.1.1",
"ember-cli": "~3.25.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli": "~3.26.1",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-blueprint-test-helpers": "^0.19.1",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.1.2",
Expand All @@ -88,7 +88,6 @@
"ember-cli-version-checker": "^5.1.1",
"ember-cli-yuidoc": "^0.9.1",
"ember-compatibility-helpers": "^1.2.0",
"ember-decorators-polyfill": "^1.1.5",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.1",
"ember-load-initializers": "^2.1.1",
Expand Down
1 change: 1 addition & 0 deletions packages/-ember-data/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = function(defaults) {
},
'ember-cli-babel': {
throwUnlessParallelizable: true,
includeExternalHelpers: true,
},
'ember-cli-terser': {
exclude: ['assets/dummy.js', 'assets/tests.js', 'assets/test-support.js', 'dist/docs/*', 'docs/*'],
Expand Down
5 changes: 2 additions & 3 deletions packages/-ember-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"@ember/string": "^1.0.0",
"@glimmer/env": "^0.1.7",
"broccoli-merge-trees": "^4.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-typescript": "^4.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-typescript": "^4.1.0",
"ember-inflector": "^4.0.1"
},
"devDependencies": {
Expand Down Expand Up @@ -68,7 +68,6 @@
"ember-cli-typescript-blueprints": "^3.0.0",
"ember-cli-yuidoc": "^0.9.1",
"ember-compatibility-helpers": "^1.2.0",
"ember-decorators-polyfill": "^1.1.5",
"ember-disable-prototype-extensions": "^1.1.3",
"ember-export-application-global": "^2.0.1",
"ember-load-initializers": "^2.1.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@ember-data/store": "3.27.0",
"@ember/edition-utils": "^1.2.0",
"@ember/string": "^1.0.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-babel": "^7.26.6",
"ember-cli-test-info": "^1.0.0",
"ember-cli-typescript": "^4.0.0"
},
Expand Down Expand Up @@ -61,4 +61,4 @@
"node": "12.16.2",
"yarn": "1.22.4"
}
}
}
4 changes: 2 additions & 2 deletions packages/canary-features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
},
"scripts": {},
"dependencies": {
"ember-cli-babel": "^7.26.3",
"ember-cli-typescript": "^4.0.0"
"ember-cli-babel": "^7.26.6",
"ember-cli-typescript": "^4.1.0"
},
"devDependencies": {
"babel-plugin-debug-macros": "^0.3.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@ember-data/private-build-infra": "3.27.0",
"@ember/edition-utils": "^1.2.0",
"@ember/string": "^1.0.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-babel": "^7.26.6",
"ember-cli-test-info": "^1.0.0",
"ember-cli-typescript": "^4.0.0"
},
Expand Down Expand Up @@ -59,4 +59,4 @@
"node": "12.16.2",
"yarn": "1.22.4"
}
}
}
2 changes: 1 addition & 1 deletion packages/model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@ember-data/store": "3.27.0",
"@ember/edition-utils": "^1.2.0",
"@ember/string": "^1.0.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-babel": "^7.26.6",
"ember-cli-string-utils": "^1.1.0",
"ember-cli-test-info": "^1.0.0",
"ember-cli-typescript": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/private-build-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"broccoli-rollup": "^4.1.1",
"calculate-cache-key-for-tree": "^2.0.0",
"chalk": "^4.0.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-babel": "^7.26.6",
"ember-cli-path-utils": "^1.0.0",
"ember-cli-string-utils": "^1.1.0",
"ember-cli-typescript": "^3.1.3",
Expand All @@ -48,4 +48,4 @@
"node": "12.16.2",
"yarn": "1.22.4"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const calculateCacheKeyForTree = require('calculate-cache-key-for-tree');
const Funnel = require('broccoli-funnel');
const merge = require('broccoli-merge-trees');
const BroccoliDebug = require('broccoli-debug');
const VersionChecker = require('ember-cli-version-checker');

const rollupPrivateModule = require('./utilities/rollup-private-module');

Expand Down Expand Up @@ -150,11 +151,28 @@ function addonBuildConfigForDataPackage(PackageName) {
this._setupBabelOptions();

let babel = this.addons.find(addon => addon.name === 'ember-cli-babel');
let externalDeps = this.externalDependenciesForPrivateModule();

const host = this._findHost();

// don't print this for consumers
if (this.isDevelopingAddon()) {
// eslint-disable-next-line no-console
console.log(
`Rolling up ${this.name} private modules with the following external dependencies: ['${externalDeps.join(
"', '"
)}']`
);
}
let checker = new VersionChecker(this.project);
let emberVersion = checker.for('ember-source');

let privateTree = rollupPrivateModule(tree, {
packageName: PackageName,
babelCompiler: babel,
babelOptions: this.options.babel,
emberVersion: emberVersion,
emberCliBabelOptions: host.options && host.options['ember-cli-babel'] ? host.options['ember-cli-babel'] : {},
onWarn: this._suppressUneededRollupWarnings.bind(this),
externalDependencies: this.externalDependenciesForPrivateModule(),
destDir: this.getOutputDirForVersion(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,53 @@ module.exports = function rollupPrivateModule(tree, options) {
destDir: '-private',
});

const emberCliBabelOptions = {
// we leave our output as valid ES
// for the consuming app's config to transpile as desired
// so we don't want to compileModules to amd here
compileModules: false,

// we never need this on our own stuff
disableEmberDataPackagesPolyfill: true,

// TODO for the embroider world we want to leave our -private module
// as an es module and only transpile the few things we genuinely care about.
// ideally this would occur as a pre-publish step so that consuming apps would
// just see a `-private.js` file and not pay any additional costs.
// CURRENTLY we transpile the -private module fully acccording to the
// consuming app's config, so we must leave these enabled.
disablePresetEnv: false,
disableDebugTooling: false,
disableDecoratorTransforms: false,

throwUnlessParallelizable: true,

// consuming app will take care of this if needed,
// we don't need to also include
includePolyfill: false,

// defer to consuming app's selection
// necessary as only consuming app can set this, must only have
// one copy
includeExternalHelpers: options.emberCliBabelOptions.includeExternalHelpers || false,

extensions: ['js', 'ts'],
};

// and we don't want
// to convert imports to globals when real modules is possible
// this is necessary because compileModules: false forces globals
// conversion without it.
if (options.emberVersion.gte('3.27.0')) {
// TODO should we just set this all the time?
// yes, this needs to be "false" to disable it in 3.27+
// when compileModules is false (which it is)
emberCliBabelOptions.disableEmberModulesAPIPolyfill = false;
}

let privateTree = babelCompiler.transpileTree(debugTree(withPrivate, 'babel-private:input'), {
babel: babelOptions,
'ember-cli-babel': {
compileModules: false,
extensions: ['js', 'ts'],
},
'ember-cli-babel': emberCliBabelOptions,
});

privateTree = debugTree(privateTree, 'babel-private:output');
Expand All @@ -27,7 +68,7 @@ module.exports = function rollupPrivateModule(tree, options) {
output: [
{
file: `${packageName}/-private.js`,
format: babelCompiler.shouldCompileModules() ? 'amd' : 'es',
format: 'amd',
amd: { id: `${packageName}/-private` },
exports: 'named',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/record-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@ember-data/store": "3.27.0",
"@ember/edition-utils": "^1.2.0",
"@ember/ordered-set": "^4.0.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-babel": "^7.26.6",
"ember-cli-test-info": "^1.0.0",
"ember-cli-typescript": "^4.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/serializer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dependencies": {
"@ember-data/private-build-infra": "3.27.0",
"@ember-data/store": "3.27.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-babel": "^7.26.6",
"ember-cli-test-info": "^1.0.0",
"ember-cli-typescript": "^4.0.0"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"@ember-data/canary-features": "3.27.0",
"@ember-data/private-build-infra": "3.27.0",
"@ember/string": "^1.0.0",
"ember-cli-babel": "^7.26.3",
"@glimmer/tracking": "^1.0.4",
"ember-cli-babel": "^7.26.6",
"ember-cli-path-utils": "^1.0.0",
"ember-cli-typescript": "^4.0.0",
"heimdalljs": "^0.3.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"@ember-data/unpublished-test-infra": "3.27.0",
"@ember/optional-features": "^1.3.0",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.25.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli": "~3.26.1",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.1.2",
"ember-cli-inject-live-reload": "^2.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"@ember-data/unpublished-test-infra": "3.27.0",
"@ember/optional-features": "^1.3.0",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.25.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli": "~3.26.1",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.1.2",
"ember-cli-inject-live-reload": "^2.0.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/unpublished-fastboot-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"@types/qunit": "^2.5.3",
"@types/rsvp": "^4.0.3",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.25.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli": "~3.26.1",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-fastboot": "^2.2.1",
"ember-cli-fastboot-testing": "^0.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"@ember-data/unpublished-test-infra": "3.27.0",
"@ember/optional-features": "^1.3.0",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.25.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli": "~3.26.1",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.1.2",
"ember-cli-inject-live-reload": "^2.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"@ember-data/unpublished-test-infra": "3.27.0",
"@ember/optional-features": "^1.3.0",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.25.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli": "~3.26.1",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.1.2",
"ember-cli-inject-live-reload": "^2.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"@ember-data/unpublished-test-infra": "3.27.0",
"@ember/optional-features": "^1.3.0",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.25.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli": "~3.26.1",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.1.2",
"ember-cli-inject-live-reload": "^2.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"@ember-data/unpublished-test-infra": "3.27.0",
"@ember/optional-features": "^1.3.0",
"broccoli-asset-rev": "^3.0.0",
"ember-cli": "~3.25.0",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli": "~3.26.1",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.6",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-htmlbars": "^5.1.2",
"ember-cli-inject-live-reload": "^2.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/unpublished-test-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@ember-data/private-build-infra": "3.27.0",
"@ember/edition-utils": "^1.2.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-babel": "^7.26.6",
"ember-cli-blueprint-test-helpers": "^0.19.2",
"ember-cli-typescript": "^4.0.0",
"ember-get-config": "^0.2.4",
Expand Down Expand Up @@ -55,4 +55,4 @@
"node": "12.16.2",
"yarn": "1.22.4"
}
}
}
Loading