Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Remove MODULE_UNIFICATION experiment.
Browse files Browse the repository at this point in the history
This was deprecated in 3.15 then included in 3.16 (an LTS release), and
can now be removed.
  • Loading branch information
rwjblue committed Feb 14, 2020
1 parent 59bf2b5 commit 5ecf34d
Show file tree
Hide file tree
Showing 40 changed files with 855 additions and 1,992 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ jobs:
feature-flag:
- EMBER_CLI_ENABLE_ALL_EXPERIMENTS
- EMBER_CLI_PACKAGER
- EMBER_CLI_MODULE_UNIFICATION
- EMBER_CLI_BROCCOLI_WATCHER

steps:
- uses: actions/checkout@v1
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ jobs:

- env: EMBER_CLI_ENABLE_ALL_EXPERIMENTS=true
- env: EMBER_CLI_PACKAGER=true
- env: EMBER_CLI_MODULE_UNIFICATION=true

- stage: deploy
name: Publish API Docs
Expand Down
3 changes: 1 addition & 2 deletions blueprints/in-repo-addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ module.exports = {
},

_processTokens(name) {
let isModuleUnification = this.project.isModuleUnification && this.project.isModuleUnification();
let root = isModuleUnification ? 'packages' : 'lib';
let root = 'lib';

if (name.match(/[./]/)) {
root = path.dirname(name);
Expand Down
16 changes: 0 additions & 16 deletions blueprints/packages/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/experiments.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ to ensure all tests pass when the feature is enabled _or_ disabled:
const { isExperimentEnabled } = require('../experiments');

// ...snip...
if (isExperimentEnabled('MODULE_UNIFICATION')) {
if (isExperimentEnabled('SOME_EXPERIMENT')) {
...
} else {
...
Expand Down
130 changes: 4 additions & 126 deletions lib/broccoli/default-packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ module.exports = class DefaultPackager {
this._cachedPublic = null;
this._cachedConfig = null;
this._cachedJavascript = null;
this._cachedProcessedSrc = null;
this._cachedProcessedIndex = null;
this._cachedTransformedTree = null;
this._cachedProcessedStyles = null;
Expand Down Expand Up @@ -140,7 +139,6 @@ module.exports = class DefaultPackager {
this.additionalAssetPaths = this.options.additionalAssetPaths;
this.vendorTestStaticStyles = this.options.vendorTestStaticStyles;
this.legacyTestFilesToAppend = this.options.legacyTestFilesToAppend;
this.isModuleUnificationEnabled = this.options.isModuleUnificationEnabled;
}

/*
Expand Down Expand Up @@ -181,24 +179,10 @@ module.exports = class DefaultPackager {
annotation: 'Classic: index.html',
});

if (this.isModuleUnificationEnabled) {
let srcIndex = new Funnel(tree, {
files: ['src/ui/index.html'],
getDestinationPath: () => indexFilePath,
annotation: 'Module Unification `index.html`',
});

index = mergeTrees([index, srcIndex], {
overwrite: true,
annotation: 'Classic And Module Unification `index.html`',
});
}

let patterns = configReplacePatterns({
addons: this.project.addons,
autoRun: this.autoRun,
storeConfigInMeta: this.storeConfigInMeta,
isModuleUnification: this.isModuleUnificationEnabled,
});

this._cachedProcessedIndex = new ConfigReplace(index, this.packageConfig(), {
Expand Down Expand Up @@ -242,7 +226,7 @@ module.exports = class DefaultPackager {
'app-and-deps:post-templates'
);

let trees = [allTrees, appContentsWithCompiledTemplates, this.processJavascriptSrc(allTrees)].filter(Boolean);
let trees = [allTrees, appContentsWithCompiledTemplates].filter(Boolean);

let mergedTree = this._debugTree(
mergeTrees(trees, {
Expand Down Expand Up @@ -387,7 +371,6 @@ module.exports = class DefaultPackager {
addons: this.project.addons,
autoRun: this.autoRun,
storeConfigInMeta: this.storeConfigInMeta,
isModuleUnification: this.isModuleUnificationEnabled,
});

let configTree = this.packageConfig();
Expand Down Expand Up @@ -449,20 +432,6 @@ module.exports = class DefaultPackager {

let mergedTemplates = [appFiles];

if (this.isModuleUnificationEnabled) {
let include = this.registry.extensionsForType('template').map(extension => `**/*/template.${extension}`);

let mu = new Funnel(inputTree, {
srcDir: 'src',
destDir: `${this.name}/src`,
include,
exclude: ['templates/**/*'],
annotation: 'MU Templates',
});
mu = this._debugTree(mu, 'mu-layout:tree:template');
mergedTemplates.push(mu);
}

mergedTemplates = mergeTrees(mergedTemplates, {
overwrite: true,
annotation: 'Templates',
Expand Down Expand Up @@ -586,12 +555,7 @@ module.exports = class DefaultPackager {
let stylesAndVendor = callAddonsPreprocessTreeHook(this.project, 'css', tree);
stylesAndVendor = this._debugTree(stylesAndVendor, 'mu-layout:addonsPreprocessTree:css');

let preprocessedStyles = preprocessCss(
stylesAndVendor,
this.isModuleUnificationEnabled ? 'src/ui/styles' : '/app/styles',
'/assets',
options
);
let preprocessedStyles = preprocessCss(stylesAndVendor, '/app/styles', '/assets', options);
preprocessedStyles = this._debugTree(preprocessedStyles, 'mu-layout:preprocess:css');

let vendorStyles = [];
Expand Down Expand Up @@ -634,63 +598,6 @@ module.exports = class DefaultPackager {
return this._cachedProcessedStyles;
}

/*
* Runs pre/post-processors hooks on the application javascript files
* and returns a single tree with the processed ones.
*
* Used only when `MODULE_UNIFICATION` experiment is enabled.
*
* Given a tree:
*
* ```
* /
* └── src
* ├── main.js
* ├── resolver.js
* ├── router.js
* └── ui
* ├── components
* ├── index.html
* ├── routes
* │ └── application
* │ └── template.hbs
* └── styles
* └── app.css
* ```
*
* Returns the tree with only the JS/TS files, but with processed files.
*
* @private
* @method processJavascriptSrc
* @param {BroccoliTree} tree
* @return {BroccoliTree}
*/
processJavascriptSrc(tree) {
if (this._cachedProcessedSrc === null && this.isModuleUnificationEnabled) {
let src = new Funnel(tree, {
srcDir: 'src',
destDir: 'src',
include: ['**/*.{js,ts}'],
exclude: ['**/*-test.{js,ts}'],
annotation: 'Module Unification Src',
});

let srcAfterPreprocessTreeHook = callAddonsPreprocessTreeHook(this.project, 'src', src);
srcAfterPreprocessTreeHook = this._debugTree(srcAfterPreprocessTreeHook, 'mu-layout:addonsPreprocessTree:js');

let srcAfterPostprocessTreeHook = callAddonsPostprocessTreeHook(this.project, 'src', srcAfterPreprocessTreeHook);
srcAfterPostprocessTreeHook = this._debugTree(srcAfterPostprocessTreeHook, 'mu-layout:addonsPostprocessTree:js');

this._cachedProcessedSrc = new Funnel(mergeTrees([srcAfterPostprocessTreeHook], { ovewrite: true }), {
srcDir: '/',
destDir: this.name,
annotation: 'Funnel: src',
});
}

return this._cachedProcessedSrc;
}

/*
* Given an input tree, returns a properly assembled Broccoli tree with bower
* components.
Expand Down Expand Up @@ -825,36 +732,9 @@ module.exports = class DefaultPackager {
annotation: 'Tests To Process',
});

if (this.isModuleUnificationEnabled) {
let destDir, testSrcTree, srcDir;

// ember-addon
if (this.name === 'dummy') {
testSrcTree = 'src';
destDir = `${this.project.name()}/src`;
} else {
testSrcTree = tree;
destDir = `${this.name}/src`;
srcDir = 'src';
}
testSrcTree = new Funnel(testSrcTree, {
srcDir,
include: ['**/*-test.{js,ts}'],
annotation: 'Module Unification Tests',
});

testSrcTree = new Funnel(testSrcTree, {
destDir,
});

treeToCompile = mergeTrees([treeToCompile, testSrcTree], {
annotation: 'Merge MU Tests',
});
}

treeToCompile = callAddonsPreprocessTreeHook(this.project, 'test', treeToCompile);

const inputPath = this.isModuleUnificationEnabled ? '/' : '/tests';
const inputPath = '/tests';
let preprocessedTests = preprocessJs(treeToCompile, inputPath, this.name, {
registry: this.registry,
});
Expand Down Expand Up @@ -957,7 +837,6 @@ module.exports = class DefaultPackager {
addons: this.project.addons,
autoRun: this.autoRun,
storeConfigInMeta: this.storeConfigInMeta,
isModuleUnification: this.isModuleUnificationEnabled,
});

let configPath = path.join(this.name, 'config', 'environments', 'test.json');
Expand Down Expand Up @@ -1004,7 +883,6 @@ module.exports = class DefaultPackager {
addons: this.project.addons,
autoRun: this.autoRun,
storeConfigInMeta: this.storeConfigInMeta,
isModuleUnification: this.isModuleUnificationEnabled,
});

let configPath = path.join(this.name, 'config', 'environments', `test.json`);
Expand Down Expand Up @@ -1065,7 +943,7 @@ module.exports = class DefaultPackager {
});

return concat(appTestTrees, {
inputFiles: ['**/{tests,src}/**/*.js'],
inputFiles: ['**/tests/**/*.js'],
headerFiles: ['vendor/ember-cli/tests-prefix.js'],
footerFiles: ['vendor/ember-cli/app-config.js', 'vendor/ember-cli/tests-suffix.js'],
outputFile: this.distPaths.testJsFile,
Expand Down
5 changes: 0 additions & 5 deletions lib/broccoli/ember-addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class EmberAddon extends EmberApp {
trees: {
app: 'tests/dummy/app',
public: 'tests/dummy/public',
src: null,
styles: 'tests/dummy/app/styles',
templates: 'tests/dummy/app/templates',
tests: new Funnel('tests', {
Expand All @@ -54,10 +53,6 @@ class EmberAddon extends EmberApp {
overrides.trees.styles = null;
overrides.trees.templates = null;
}
if (fs.existsSync('tests/dummy/src')) {
overrides.trees.src = 'tests/dummy/src';
overrides.trees.styles = 'tests/dummy/src/ui/styles';
}

if (fs.existsSync('tests/dummy/vendor')) {
overrides.trees.vendor = 'tests/dummy/vendor';
Expand Down
Loading

0 comments on commit 5ecf34d

Please sign in to comment.