babel-plugin-alias-modules
Advanced tools
Comparing version 2.19.4 to 2.20.0
{ | ||
"author": "Liferay Frontend Infrastructure Team <pt-frontend-infrastructure@liferay.com>", | ||
"dependencies": { | ||
"liferay-npm-build-tools-common": "2.19.4" | ||
"liferay-npm-build-tools-common": "2.20.0" | ||
}, | ||
@@ -19,4 +19,4 @@ "description": "A Babel plugin to rewrite aliased require() calls.", | ||
}, | ||
"version": "2.19.4", | ||
"gitHead": "d341f385c91a7d50168a6ce8be978d2f03f6bedc" | ||
"version": "2.20.0", | ||
"gitHead": "c346146c8c8e6f7c12356f68dc7153efc6445e89" | ||
} |
@@ -7,5 +7,3 @@ # babel-plugin-alias-modules | ||
The plugin can be configured using | ||
[.npmbundlerrc global config section](https://github.com/liferay/liferay-js-toolkit/wiki/.npmbundlerrc-file-reference#config) | ||
or in the plugin configuration itself. | ||
The plugin can be configured using [.npmbundlerrc global config section](https://github.com/liferay/liferay-frontend-projects/tree/master/maintenance/projects/js-toolkit/docs/.npmbundlerrc-file-reference.md#config) or in the plugin configuration itself. | ||
@@ -22,33 +20,22 @@ In both cases the structure is the same: | ||
This resembles webpack's | ||
[resolve.aliasFields](https://webpack.js.org/configuration/resolve/#resolvealiasfields) | ||
which serves the same purpose. | ||
This resembles webpack's [resolve.aliasFields](https://webpack.js.org/configuration/resolve/#resolvealiasfields) which serves the same purpose. | ||
Normally global config is preferred, but you can leverage plugin configuration | ||
when you need different alias fields for different packages. | ||
Normally global config is preferred, but you can leverage plugin configuration when you need different alias fields for different packages. | ||
The default value for `resolve.aliasFields` is `['browser']` as in webpack. | ||
Note that this plugin used to look for `unpkg` and `jsdelivr` fields too, but it | ||
caused problems (see https://github.com/liferay/liferay-js-toolkit/issues/365 | ||
for more information). | ||
Note that this plugin used to look for `unpkg` and `jsdelivr` fields too, but it caused problems (see https://github.com/liferay/liferay-js-toolkit/issues/365 for more information). | ||
## Technical Details | ||
This plugin scans `package.json` for fields defined in `resolve.aliasFields` | ||
and redirects `require()`s for aliased modules. | ||
This plugin scans `package.json` for fields defined in `resolve.aliasFields` and redirects `require()`s for aliased modules. | ||
This plugin only does one part of the whole implementation of the aliases. | ||
Aliases implementation have two parts: | ||
This plugin only does one part of the whole implementation of the aliases. Aliases implementation have two parts: | ||
1. They redirect existing modules or provide virtual ones when seen from | ||
the outside, from another package. | ||
1. They redirect existing modules or provide virtual ones when seen from the outside, from another package. | ||
2. They make local requires divert to a different target. | ||
This plugin does only the second part. The first one is performed by | ||
[liferay-npm-bundler-plugin-replace-browser-modules](https://github.com/liferay/liferay-js-toolkit/tree/master/packages/liferay-npm-bundler-plugin-replace-browser-modules). | ||
This plugin does only the second part. The first one is performed by [liferay-npm-bundler-plugin-replace-browser-modules](https://github.com/liferay/liferay-frontend-projects/tree/master/maintenance/projects/js-toolkit/packages/liferay-npm-bundler-plugin-replace-browser-modules). | ||
Please read the | ||
[`browser` field specification](https://github.com/defunctzombie/package-browser-field-spec) | ||
for more information. | ||
Please read the [`browser` field specification](https://github.com/defunctzombie/package-browser-field-spec) for more information. |
@@ -96,3 +96,4 @@ /** | ||
).linkToCode(5); | ||
} else if (aliasedModuleName !== argument.value) { | ||
} | ||
else if (aliasedModuleName !== argument.value) { | ||
argument.value = aliasedModuleName; | ||
@@ -134,2 +135,3 @@ | ||
if (mod.isLocalModule(requiredModuleName)) { | ||
// First look in file directory (without recursion) | ||
@@ -168,3 +170,4 @@ | ||
} | ||
} else { | ||
} | ||
else { | ||
alias = this._getAliasForExternal(absFileDir, requiredModule); | ||
@@ -171,0 +174,0 @@ } |
25326
726
40
+ Addedbabel-plugin-add-module-metadata@2.20.0(transitive)
+ Addedbabel-plugin-name-amd-modules@2.20.0(transitive)
+ Addedbabel-plugin-namespace-amd-define@2.20.0(transitive)
+ Addedbabel-plugin-namespace-modules@2.20.0(transitive)
+ Addedbabel-plugin-normalize-requires@2.20.0(transitive)
+ Addedbabel-plugin-wrap-modules-amd@2.20.0(transitive)
+ Addedbabel-preset-liferay-standard@2.20.0(transitive)
+ Addedliferay-npm-build-tools-common@2.20.0(transitive)
+ Addedliferay-npm-bundler-plugin-exclude-imports@2.20.0(transitive)
+ Addedliferay-npm-bundler-plugin-inject-imports-dependencies@2.20.0(transitive)
+ Addedliferay-npm-bundler-plugin-inject-peer-dependencies@2.20.0(transitive)
+ Addedliferay-npm-bundler-plugin-namespace-packages@2.20.0(transitive)
+ Addedliferay-npm-bundler-plugin-replace-browser-modules@2.20.0(transitive)
+ Addedliferay-npm-bundler-plugin-resolve-linked-dependencies@2.20.0(transitive)
+ Addedliferay-npm-bundler-preset-standard@2.20.0(transitive)
- Removedbabel-plugin-add-module-metadata@2.19.4(transitive)
- Removedbabel-plugin-name-amd-modules@2.19.4(transitive)
- Removedbabel-plugin-namespace-amd-define@2.19.4(transitive)
- Removedbabel-plugin-namespace-modules@2.19.4(transitive)
- Removedbabel-plugin-normalize-requires@2.19.4(transitive)
- Removedbabel-plugin-wrap-modules-amd@2.19.4(transitive)
- Removedbabel-preset-liferay-standard@2.19.4(transitive)
- Removedliferay-npm-build-tools-common@2.19.4(transitive)
- Removedliferay-npm-bundler-plugin-exclude-imports@2.19.4(transitive)
- Removedliferay-npm-bundler-plugin-inject-imports-dependencies@2.19.4(transitive)
- Removedliferay-npm-bundler-plugin-inject-peer-dependencies@2.19.4(transitive)
- Removedliferay-npm-bundler-plugin-namespace-packages@2.19.4(transitive)
- Removedliferay-npm-bundler-plugin-replace-browser-modules@2.19.4(transitive)
- Removedliferay-npm-bundler-plugin-resolve-linked-dependencies@2.19.4(transitive)
- Removedliferay-npm-bundler-preset-standard@2.19.4(transitive)