Skip to content

Commit

Permalink
2.4.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
JayCanuck committed Jan 29, 2020
2 parents 64d942b + f850559 commit af8d202
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.4.2 (January 29, 2020)

* `EnactFrameworkPlugin`: Added support for ilib inclusion in bundles.
* `EnactFrameworkRefPlugin`: Added support for `ignore` array option for package paths to handle internally, rather than deferred to external.
* `ILibPlugin`: Removed special handling for moonstone package and added generic constant support for root-level packages.

# 2.4.1 (September 4, 2019)

* `SnapshotPlugin`: Fixed V8 snapshotting when `ilib` external package is not found.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Resolves the active package root path and metadata.
Unless otherwise specified, all content, including all source code files and
documentation files in this repository are:

Copyright (c) 2016-2019 LG Electronics
Copyright (c) 2016-2020 LG Electronics

Unless otherwise specified or set forth in the NOTICE file, all content,
including all source code files and documentation files in this repository are:
Expand Down
2 changes: 1 addition & 1 deletion mixins/externals.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
config.plugins.push(
new EnactFrameworkRefPlugin({
name: 'enact_framework',
libraries: ['@enact', 'react', 'react-dom'],
libraries: ['@enact', 'react', 'react-dom', 'ilib'],
external: {
publicPath: opts['externals-public'] || opts.externalsPublic || opts.externals,
snapshot: opts.snapshot
Expand Down
17 changes: 17 additions & 0 deletions mixins/framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,30 @@ module.exports = {
'**/build/**/*.*',
'**/dist/**/*.*',
'**/@enact/dev-utils/**/*.*',
'**/@enact/storybook-utils/**/*.*',
'**/@enact/ui-test-utils/**/*.*',
'**/@enact/screenshot-test-utils/**/*.*',
'**/ilib/localedata/**/*.*',
path.join(config.output.path, '*'),
'**/node_modules/**/*.*',
'**/tests/*.js'
],
follow: true
})
.concat(
glob.sync('ilib/**/*.@(js|jsx|es6)', {
cwd: path.resolve(path.join(app, 'node_modules')),
nodir: true,
ignore: [
'**/localedata/**/*.*',
'**/node_modules/**/*.*',
'**/ilib-node*.js',
'**/AsyncNodeLoader.js',
'**/NodeLoader.js'
],
follow: true
})
)
.concat(['react', 'react-dom'])
};

Expand Down
2 changes: 2 additions & 0 deletions mixins/unmangled.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ module.exports = {
// Allow Terser's optimizations/debug-code-removal but don't minify
const terserPlugin = helper.getMinimizerByName(config, 'TerserPlugin');
if (terserPlugin) {
terserPlugin.options.terserOptions = terserPlugin.options.terserOptions || {};
terserPlugin.options.terserOptions.mangle = false;
terserPlugin.options.terserOptions.output = terserPlugin.options.terserOptions.output || {};
terserPlugin.options.terserOptions.output.beautify = true;
terserPlugin.options.terserOptions.output.comments = true;
config.output.pathinfo = true;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enact/dev-utils",
"version": "2.4.1",
"version": "2.4.2",
"description": "A collection of development utilities for Enact apps.",
"main": "index.js",
"author": "Jason Robitaille <jason.robitaille@lge.com>",
Expand Down
23 changes: 13 additions & 10 deletions plugins/ILibPlugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ function transformPath(context, file) {
.replace(/\.\.(\/)?/g, '_$1');
}

function bundleConst(name) {
return (
'ILIB_' +
path
.basename(name)
.toUpperCase()
.replace(/[-_\s]/g, '_') +
'_PATH'
);
}

function resolveBundle(dir, context) {
const bundle = {resolved: dir, path: dir, emit: true};
if (path.isAbsolute(bundle.path)) {
Expand Down Expand Up @@ -185,11 +196,6 @@ class ILibPlugin {
if (typeof this.options.resources === 'undefined') {
this.options.resources = 'resources';
}
if ((!this.options.bundles || !this.options.bundles.moonstone) && pkgName === '@enact/moonstone') {
this.options.bundles = this.options.bundles || {};
this.options.bundles.moonstone = 'resources';
this.options.resources = '_resources_';
}

this.options.cache = typeof this.options.cache !== 'boolean' || this.options.cache;
this.options.create = typeof this.options.create !== 'boolean' || this.options.create;
Expand Down Expand Up @@ -224,15 +230,12 @@ class ILibPlugin {
ILIB_RESOURCES_PATH: resolveBundle(opts.resources || 'resources', opts.context).resolved,
ILIB_CACHE_ID: '__webpack_require__.ilib_cache_id'
};
definedConstants[bundleConst(app.name)] = definedConstants.ILIB_RESOURCES_PATH;
for (const name in opts.bundles) {
if (opts.bundles[name]) {
const bundle = resolveBundle(opts.bundles[name], opts.context);
const bundleManifest = path.join(bundle.path, 'ilibmanifest.json');
const envName = path
.basename(name)
.toUpperCase()
.replace(/[-_\s]/g, '_');
definedConstants['ILIB_' + envName + '_PATH'] = bundle.resolved;
definedConstants[bundleConst(name)] = bundle.resolved;
if (opts.emit && bundle.emit && fs.existsSync(bundleManifest)) {
manifests.push(bundleManifest);
}
Expand Down
14 changes: 12 additions & 2 deletions plugins/dll/EnactFrameworkRefPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ class DelegatedEnactFactoryPlugin {
apply(normalModuleFactory) {
const name = this.options.name;
const libReg = new RegExp('^(' + this.options.libraries.join('|') + ')(?=[\\\\\\/]|$)');
const ignReg =
this.options.ignore &&
new RegExp('^(' + this.options.ignore.map(p => p.replace('/', '\\/')).join('|') + ')(?=[\\\\\\/]|$)');
normalModuleFactory.hooks.factory.tap('DelegatedEnactFactoryPlugin', factory => {
return function(data, callback) {
const dependency = data.dependencies[0];
const request = dependency.request;
if (request && libReg.test(request)) {
if (request && libReg.test(request) && (!ignReg || !ignReg.test(request))) {
return callback(null, new DelegatedModule(name, {id: request}, 'require', request, request));
}
return factory(data, callback);
Expand Down Expand Up @@ -51,6 +54,12 @@ class EnactFrameworkRefPlugin {
this.options = options;
this.options.name = this.options.name || 'enact_framework';
this.options.libraries = this.options.libraries || ['@enact', 'react', 'react-dom', 'ilib'];
this.options.ignore = this.options.ignore || [
'@enact/dev-utils',
'@enact/storybook-utils',
'@enact/ui-test-utils',
'@enact/screenshot-test-utils'
];
this.options.external = this.options.external || {};
this.options.external.publicPath =
this.options.publicPath || this.options.external.publicPath || this.options.external.path;
Expand Down Expand Up @@ -108,7 +117,8 @@ class EnactFrameworkRefPlugin {
compiler.hooks.compile.tap('EnactFrameworkRefPlugin', ({normalModuleFactory}) => {
new DelegatedEnactFactoryPlugin({
name: this.options.name,
libraries: this.options.libraries
libraries: this.options.libraries,
ignore: this.options.ignore
}).apply(normalModuleFactory);
});
}
Expand Down

0 comments on commit af8d202

Please sign in to comment.