@atlassian/webresource-webpack-plugin 4.10.2-64a2ef2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +20 -0
- package/.eslintrc +72 -0
- package/.nvmrc +1 -0
- package/.prettierrc +6 -0
- package/CHANGELOG.md +318 -0
- package/CONTRIBUTING.md +92 -0
- package/LICENSE +13 -0
- package/README.md +709 -0
- package/RELEASE.md +17 -0
- package/package.json +118 -0
- package/src/AppResources.js +198 -0
- package/src/QUnitTestResources.js +88 -0
- package/src/WebpackHelpers.js +176 -0
- package/src/WebpackRuntimeHelpers.js +7 -0
- package/src/WrmPlugin.js +676 -0
- package/src/defaults/builtInProvidedDependencies.js +22 -0
- package/src/flattenReduce.js +1 -0
- package/src/helpers/options-parser.js +32 -0
- package/src/helpers/provided-dependencies.js +21 -0
- package/src/helpers/string.js +12 -0
- package/src/helpers/web-resource-entrypoints.js +66 -0
- package/src/helpers/web-resource-generator.js +138 -0
- package/src/helpers/web-resource-parser.js +44 -0
- package/src/helpers/xml.js +44 -0
- package/src/logger.js +28 -0
- package/src/mergeMaps.js +32 -0
- package/src/renderCondition.js +29 -0
- package/src/renderTransformation.js +44 -0
- package/src/settings/base-dependencies.js +42 -0
- package/src/shims/qunit-require-shim.js +19 -0
- package/src/types/typedefs.js +50 -0
- package/src/webpack-modules/EmptyExportsModule.js +26 -0
- package/src/webpack-modules/ProvidedExternalDependencyModule.js +30 -0
- package/src/webpack-modules/WrmDependencyModule.js +12 -0
- package/src/webpack-modules/WrmResourceModule.js +33 -0
- package/test/.eslintrc +11 -0
- package/test/unit/ProvidedExternalDependencyModule.test.js +63 -0
- package/test/unit/WebpackHelpers.test.js +37 -0
- package/test/unit/renderCondition.test.js +240 -0
- package/test/unit/renderTransformation.test.js +69 -0
- package/test/unit/webpack-modules/WrmDependencyModule.test.js +24 -0
- package/test/use-cases/.eslintrc +14 -0
- package/test/use-cases/asset-content-type/asset-content-type.test.js +50 -0
- package/test/use-cases/asset-content-type/src/app.js +8 -0
- package/test/use-cases/asset-content-type/src/ice.png +0 -0
- package/test/use-cases/asset-content-type/src/rect.svg +4 -0
- package/test/use-cases/asset-content-type/webpack.config.js +33 -0
- package/test/use-cases/asset-loading-via-js/asset-loading-via-js.test.js +61 -0
- package/test/use-cases/asset-loading-via-js/src/app.js +8 -0
- package/test/use-cases/asset-loading-via-js/src/ice.png +0 -0
- package/test/use-cases/asset-loading-via-js/src/rect.svg +4 -0
- package/test/use-cases/asset-loading-via-js/webpack.config.js +31 -0
- package/test/use-cases/associations-complex/associations-complex.test.js +82 -0
- package/test/use-cases/associations-complex/package-lock.json +73 -0
- package/test/use-cases/associations-complex/package.json +9 -0
- package/test/use-cases/associations-complex/src/copied-file-should-be-ignored.js +0 -0
- package/test/use-cases/associations-complex/src/entry.js +5 -0
- package/test/use-cases/associations-complex/src/entry2.js +5 -0
- package/test/use-cases/associations-complex/src/qunit.tests.js +2 -0
- package/test/use-cases/associations-complex/src/to-be-chunked.js +1 -0
- package/test/use-cases/associations-complex/webpack.config.js +48 -0
- package/test/use-cases/associations-simple/associations-simple.test.js +65 -0
- package/test/use-cases/associations-simple/package-lock.json +69 -0
- package/test/use-cases/associations-simple/package.json +5 -0
- package/test/use-cases/associations-simple/src/simple.js +3 -0
- package/test/use-cases/associations-simple/webpack.config.js +27 -0
- package/test/use-cases/async-chunks/async-chunks.test.js +113 -0
- package/test/use-cases/async-chunks/src/app.js +9 -0
- package/test/use-cases/async-chunks/src/async-bar.js +4 -0
- package/test/use-cases/async-chunks/src/async-foo.js +2 -0
- package/test/use-cases/async-chunks/webpack.config.js +40 -0
- package/test/use-cases/async-chunks-named-context/async-chunks-named-context.test.js +76 -0
- package/test/use-cases/async-chunks-named-context/src/app.js +9 -0
- package/test/use-cases/async-chunks-named-context/src/app2.js +5 -0
- package/test/use-cases/async-chunks-named-context/src/async-async-async-bar.js +4 -0
- package/test/use-cases/async-chunks-named-context/src/async-async-bar-two.js +1 -0
- package/test/use-cases/async-chunks-named-context/src/async-async-bar.js +6 -0
- package/test/use-cases/async-chunks-named-context/src/async-bar.js +7 -0
- package/test/use-cases/async-chunks-named-context/src/async-foo.js +2 -0
- package/test/use-cases/async-chunks-named-context/webpack.config.js +43 -0
- package/test/use-cases/async-chunks-of-async-chunks/async-chunks-of-async-chunks.test.js +117 -0
- package/test/use-cases/async-chunks-of-async-chunks/src/app.js +9 -0
- package/test/use-cases/async-chunks-of-async-chunks/src/async-async-async-bar.js +4 -0
- package/test/use-cases/async-chunks-of-async-chunks/src/async-async-bar-two.js +1 -0
- package/test/use-cases/async-chunks-of-async-chunks/src/async-async-bar.js +6 -0
- package/test/use-cases/async-chunks-of-async-chunks/src/async-bar.js +7 -0
- package/test/use-cases/async-chunks-of-async-chunks/src/async-foo.js +2 -0
- package/test/use-cases/async-chunks-of-async-chunks/webpack.config.js +43 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/async-chunks-of-async-chunks-with-multiple-entrypoints.test.js +156 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/src/app.js +9 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/src/app2.js +5 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/src/async-async-async-bar.js +4 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/src/async-async-bar-two.js +1 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/src/async-async-bar.js +6 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/src/async-bar.js +7 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/src/async-foo.js +2 -0
- package/test/use-cases/async-chunks-of-async-chunks-with-multiple-entrypoints/webpack.config.js +43 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/css-and-assets-distribution-via-mini-css-extract-plugin.test.js +72 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/src/app.js +8 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/src/app2.js +6 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/src/ice.png +0 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/src/ice2.jpg +0 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/src/rect.svg +4 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/src/rect2.svg +4 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/src/styles.css +8 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/src/styles2.css +8 -0
- package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/webpack.config.js +51 -0
- package/test/use-cases/css-and-assets-via-extract-text-plugin/css-and-assets-via-extract-text-plugin.test.js +87 -0
- package/test/use-cases/css-and-assets-via-extract-text-plugin/src/feature-one.css +7 -0
- package/test/use-cases/css-and-assets-via-extract-text-plugin/src/feature-one.js +3 -0
- package/test/use-cases/css-and-assets-via-extract-text-plugin/src/feature-two.css +3 -0
- package/test/use-cases/css-and-assets-via-extract-text-plugin/src/feature-two.js +1 -0
- package/test/use-cases/css-and-assets-via-extract-text-plugin/src/ice.png +0 -0
- package/test/use-cases/css-and-assets-via-extract-text-plugin/webpack.config.js +46 -0
- package/test/use-cases/css-and-assets-via-style-loader/css-and-assets-via-style-loader.test.js +46 -0
- package/test/use-cases/css-and-assets-via-style-loader/src/app.js +6 -0
- package/test/use-cases/css-and-assets-via-style-loader/src/ice.png +0 -0
- package/test/use-cases/css-and-assets-via-style-loader/src/styles.css +7 -0
- package/test/use-cases/css-and-assets-via-style-loader/webpack.config.js +46 -0
- package/test/use-cases/cyclic-dependencies/cyclic.test.js +24 -0
- package/test/use-cases/cyclic-dependencies/src/a.js +3 -0
- package/test/use-cases/cyclic-dependencies/src/b.js +3 -0
- package/test/use-cases/cyclic-dependencies/src/root.js +3 -0
- package/test/use-cases/cyclic-dependencies/webpack.config.js +24 -0
- package/test/use-cases/data-providers/data-providers.test.js +111 -0
- package/test/use-cases/data-providers/src/first.js +2 -0
- package/test/use-cases/data-providers/src/second.js +2 -0
- package/test/use-cases/data-providers/src/third.js +2 -0
- package/test/use-cases/data-providers/webpack.config.js +73 -0
- package/test/use-cases/data-providers/webpack.config.with-map.js +33 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/ensure-runtime-overwrite-of-mini-css-extract-plugin.test.js +86 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/src/app.js +5 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/src/app2.js +5 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/src/ice.png +0 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/src/ice2.jpg +0 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/src/rect.svg +4 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/src/rect2.svg +4 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/src/styles.css +8 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/src/styles2.css +8 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/webpack.after.config.js +51 -0
- package/test/use-cases/ensure-runtime-overwrite-of-mini-css-extract-plugin/webpack.before.config.js +51 -0
- package/test/use-cases/jsonp-function-name/jsonp-function-name.test.js +37 -0
- package/test/use-cases/jsonp-function-name/src/app.js +1 -0
- package/test/use-cases/jsonp-function-name/src/foo.js +2 -0
- package/test/use-cases/jsonp-function-name/webpack.config.js +35 -0
- package/test/use-cases/jsonp-function-name-default/jsonp-function-name-default.test.js +39 -0
- package/test/use-cases/jsonp-function-name-default/src/app.js +1 -0
- package/test/use-cases/jsonp-function-name-default/src/foo.js +2 -0
- package/test/use-cases/jsonp-function-name-default/webpack.config.js +34 -0
- package/test/use-cases/location-prefix/location-prefix.test.js +29 -0
- package/test/use-cases/location-prefix/src/simple.js +6 -0
- package/test/use-cases/location-prefix/webpack.config.js +25 -0
- package/test/use-cases/provided-module-replacement/provided-module-replacement.test.js +63 -0
- package/test/use-cases/provided-module-replacement/src/app.js +3 -0
- package/test/use-cases/provided-module-replacement/webpack.config.with-map.js +33 -0
- package/test/use-cases/provided-module-replacement/webpack.config.with-object.js +34 -0
- package/test/use-cases/provided-modules-replacement-with-amd-target/provided-modules-replacement-with-amd-target.test.js +62 -0
- package/test/use-cases/provided-modules-replacement-with-amd-target/src/app.js +3 -0
- package/test/use-cases/provided-modules-replacement-with-amd-target/webpack.config.js +41 -0
- package/test/use-cases/qunit-test-wrm-web-resource/qunit-test-wrm-web-resource.test.js +157 -0
- package/test/use-cases/qunit-test-wrm-web-resource/src/app.2.js +6 -0
- package/test/use-cases/qunit-test-wrm-web-resource/src/app.js +8 -0
- package/test/use-cases/qunit-test-wrm-web-resource/src/bar-dep.js +8 -0
- package/test/use-cases/qunit-test-wrm-web-resource/src/bar-dep_test.js +1 -0
- package/test/use-cases/qunit-test-wrm-web-resource/src/foo-async.js +3 -0
- package/test/use-cases/qunit-test-wrm-web-resource/src/foo-dep.js +4 -0
- package/test/use-cases/qunit-test-wrm-web-resource/src/foo-dep_test.js +1 -0
- package/test/use-cases/qunit-test-wrm-web-resource/webpack.config.js +24 -0
- package/test/use-cases/resource-parameters/resource-parameters.test.js +77 -0
- package/test/use-cases/resource-parameters/src/app.js +12 -0
- package/test/use-cases/resource-parameters/src/ice.png +0 -0
- package/test/use-cases/resource-parameters/src/ice2.jpg +0 -0
- package/test/use-cases/resource-parameters/src/rect.svg +4 -0
- package/test/use-cases/resource-parameters/webpack.config.js +62 -0
- package/test/use-cases/resource-parameters/webpack.svg.config.js +30 -0
- package/test/use-cases/simple/simple.test.js +83 -0
- package/test/use-cases/simple/src/simple.js +3 -0
- package/test/use-cases/simple/webpack.config.js +24 -0
- package/test/use-cases/single-runtime-chunk/single-runtime-chunk.test.js +132 -0
- package/test/use-cases/single-runtime-chunk/src/first.js +2 -0
- package/test/use-cases/single-runtime-chunk/src/second.js +2 -0
- package/test/use-cases/single-runtime-chunk/src/shared.js +3 -0
- package/test/use-cases/single-runtime-chunk/src/third.js +2 -0
- package/test/use-cases/single-runtime-chunk/webpack.config.js +33 -0
- package/test/use-cases/specify-asset-dev-hash/specify-asset-dev-hash.test.js +33 -0
- package/test/use-cases/specify-asset-dev-hash/src/feature.js +6 -0
- package/test/use-cases/specify-asset-dev-hash/src/library.js +6 -0
- package/test/use-cases/specify-asset-dev-hash/webpack.config.js +71 -0
- package/test/use-cases/specify-conditions/specify-conditions.test.js +106 -0
- package/test/use-cases/specify-conditions/src/app.js +5 -0
- package/test/use-cases/specify-conditions/webpack.config.js +65 -0
- package/test/use-cases/specify-explicit-context/specify-explicit-context.test.js +89 -0
- package/test/use-cases/specify-explicit-context/src/app.js +5 -0
- package/test/use-cases/specify-explicit-context/webpack.config.js +34 -0
- package/test/use-cases/specify-explicit-context-no-autogenerated/specify-explicit-context-no-autogenerated.test.js +84 -0
- package/test/use-cases/specify-explicit-context-no-autogenerated/src/app.js +5 -0
- package/test/use-cases/specify-explicit-context-no-autogenerated/webpack.config.js +35 -0
- package/test/use-cases/specify-explicit-name/specify-explicit-name.test.js +110 -0
- package/test/use-cases/specify-explicit-name/src/app.js +5 -0
- package/test/use-cases/specify-explicit-name/webpack.config.js +43 -0
- package/test/use-cases/specify-explicit-state/specify-explicit-state.test.js +96 -0
- package/test/use-cases/specify-explicit-state/src/app.js +5 -0
- package/test/use-cases/specify-explicit-state/webpack.config.js +51 -0
- package/test/use-cases/specify-transformation/disable-transformations.test.js +77 -0
- package/test/use-cases/specify-transformation/extend-transformations.test.js +69 -0
- package/test/use-cases/specify-transformation/specify-transformation.test.js +100 -0
- package/test/use-cases/specify-transformation/src/app.js +13 -0
- package/test/use-cases/specify-transformation/src/ice.png +0 -0
- package/test/use-cases/specify-transformation/src/rect.svg +4 -0
- package/test/use-cases/specify-transformation/src/test.html +1 -0
- package/test/use-cases/specify-transformation/src/test.less +1 -0
- package/test/use-cases/specify-transformation/src/test.txt +1 -0
- package/test/use-cases/specify-transformation/webpack.disable-tranformations.config.js +31 -0
- package/test/use-cases/specify-transformation/webpack.extend-tranformations.config.js +34 -0
- package/test/use-cases/specify-transformation/webpack.specify-transformations.config.js +35 -0
- package/test/use-cases/split-chunks/split-chunks.test.js +102 -0
- package/test/use-cases/split-chunks/src/app.js +7 -0
- package/test/use-cases/split-chunks/src/app2.js +7 -0
- package/test/use-cases/split-chunks/src/bar.js +2 -0
- package/test/use-cases/split-chunks/src/foo.js +2 -0
- package/test/use-cases/split-chunks/src/foo2.js +2 -0
- package/test/use-cases/split-chunks/webpack.config.js +42 -0
- package/test/use-cases/split-chunks-with-runtime/split-chunks-with-runtime.test.js +114 -0
- package/test/use-cases/split-chunks-with-runtime/src/app.js +7 -0
- package/test/use-cases/split-chunks-with-runtime/src/app2.js +7 -0
- package/test/use-cases/split-chunks-with-runtime/src/bar.js +2 -0
- package/test/use-cases/split-chunks-with-runtime/src/foo.js +2 -0
- package/test/use-cases/split-chunks-with-runtime/src/foo2.js +2 -0
- package/test/use-cases/split-chunks-with-runtime/webpack.config.js +43 -0
- package/test/use-cases/split-chunks-with-tests/split-chunks-with-tests.test.js +216 -0
- package/test/use-cases/split-chunks-with-tests/src/app.js +7 -0
- package/test/use-cases/split-chunks-with-tests/src/app2.js +7 -0
- package/test/use-cases/split-chunks-with-tests/src/bar.js +2 -0
- package/test/use-cases/split-chunks-with-tests/src/bar_test.js +1 -0
- package/test/use-cases/split-chunks-with-tests/src/foo.js +2 -0
- package/test/use-cases/split-chunks-with-tests/src/foo2.js +2 -0
- package/test/use-cases/split-chunks-with-tests/src/foo_test.js +1 -0
- package/test/use-cases/split-chunks-with-tests/webpack.config.js +43 -0
- package/test/use-cases/standalone/src/standalone-1.js +1 -0
- package/test/use-cases/standalone/src/standalone-2.js +1 -0
- package/test/use-cases/standalone/standalone.test.js +53 -0
- package/test/use-cases/standalone/webpack.config.js +25 -0
- package/test/use-cases/wrm-dependency-loading/src-amd/app.js +7 -0
- package/test/use-cases/wrm-dependency-loading/src-es6/app.js +7 -0
- package/test/use-cases/wrm-dependency-loading/webpack.config.amd.js +22 -0
- package/test/use-cases/wrm-dependency-loading/webpack.config.es6.js +22 -0
- package/test/use-cases/wrm-dependency-loading/wrm-dependency-loading.test.js +60 -0
- package/test/use-cases/wrm-manifest-path/src/a.js +3 -0
- package/test/use-cases/wrm-manifest-path/src/app.js +3 -0
- package/test/use-cases/wrm-manifest-path/src/app2.js +3 -0
- package/test/use-cases/wrm-manifest-path/src/b.js +3 -0
- package/test/use-cases/wrm-manifest-path/webpack.config.js +27 -0
- package/test/use-cases/wrm-manifest-path/wrm-manifest-path.test.js +57 -0
- package/test/use-cases/wrm-resource-loading/src-amd/app.js +6 -0
- package/test/use-cases/wrm-resource-loading/src-es6/app.js +5 -0
- package/test/use-cases/wrm-resource-loading/src-relative/app.js +5 -0
- package/test/use-cases/wrm-resource-loading/webpack.config.amd.js +23 -0
- package/test/use-cases/wrm-resource-loading/webpack.config.es6.js +23 -0
- package/test/use-cases/wrm-resource-loading/webpack.config.relative.js +23 -0
- package/test/use-cases/wrm-resource-loading/wrm-resource-loading.test.js +89 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const assert = require('chai').assert;
|
|
2
|
+
const parse = require('xml-parser');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const targetDir = path.join(__dirname, 'target');
|
|
8
|
+
const webresourceOutput = path.join(targetDir, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml');
|
|
9
|
+
|
|
10
|
+
describe('css-and-assets-distribution-via-mini-css-extract-plugin', function() {
|
|
11
|
+
const config = require('./webpack.config.js');
|
|
12
|
+
|
|
13
|
+
let stats;
|
|
14
|
+
let entryPoint;
|
|
15
|
+
let asyncChunk;
|
|
16
|
+
let assetWebResource;
|
|
17
|
+
|
|
18
|
+
function getResources(node) {
|
|
19
|
+
return node.children.filter(n => n.name === 'resource');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
beforeEach(done => {
|
|
23
|
+
webpack(config, (err, st) => {
|
|
24
|
+
stats = st;
|
|
25
|
+
|
|
26
|
+
const xmlFile = fs.readFileSync(webresourceOutput, 'utf-8');
|
|
27
|
+
const results = parse(xmlFile);
|
|
28
|
+
entryPoint = results.root.children.find(n => n.attributes.key === 'entrypoint-app');
|
|
29
|
+
asyncChunk = results.root.children.find(n => n.attributes.key === '0');
|
|
30
|
+
assetWebResource = results.root.children.find(n => n.attributes.key === 'assets-DEV_PSEUDO_HASH');
|
|
31
|
+
done();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should build without failing', () => {
|
|
36
|
+
assert.ok(entryPoint);
|
|
37
|
+
assert.ok(asyncChunk);
|
|
38
|
+
assert.equal(stats.hasErrors(), false);
|
|
39
|
+
assert.equal(stats.hasWarnings(), false);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should add the stylesheet and the contained assets of the stylesheet as resources to the entry', () => {
|
|
43
|
+
const entryResources = getResources(entryPoint);
|
|
44
|
+
assert.equal(entryResources.length, 4);
|
|
45
|
+
assert.equal(entryResources[0].attributes.type, 'download');
|
|
46
|
+
assert.equal(entryResources[0].attributes.name, 'app.css');
|
|
47
|
+
assert.equal(entryResources[1].attributes.type, 'download');
|
|
48
|
+
assert.equal(entryResources[1].attributes.name, 'app.js');
|
|
49
|
+
assert.equal(path.extname(entryResources[2].attributes.name), '.png');
|
|
50
|
+
assert.equal(path.extname(entryResources[3].attributes.name), '.jpg');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should add the stylesheet and the contained assets of the stylesheet of the async chunk to the async chunk', () => {
|
|
54
|
+
const asyncResources = getResources(asyncChunk);
|
|
55
|
+
assert.equal(asyncResources.length, 4);
|
|
56
|
+
assert.equal(asyncResources[0].attributes.name, '0.css');
|
|
57
|
+
assert.equal(asyncResources[0].attributes.type, 'download');
|
|
58
|
+
assert.equal(asyncResources[1].attributes.name, '0.js');
|
|
59
|
+
assert.equal(asyncResources[1].attributes.type, 'download');
|
|
60
|
+
assert.equal(path.extname(asyncResources[2].attributes.name), '.svg');
|
|
61
|
+
assert.equal(path.extname(asyncResources[3].attributes.name), '.svg');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should create an asset resource containing all "other" assets', () => {
|
|
65
|
+
const assetWebResourceResources = getResources(assetWebResource);
|
|
66
|
+
assert.equal(assetWebResourceResources.length, 4);
|
|
67
|
+
const names = assetWebResourceResources.map(awrr => path.extname(awrr.attributes.name));
|
|
68
|
+
assert.include(names, '.jpg', 'fails to include any jpg files');
|
|
69
|
+
assert.include(names, '.svg', 'fails to include any svg files');
|
|
70
|
+
assert.include(names, '.png', 'fails to include any png files');
|
|
71
|
+
});
|
|
72
|
+
});
|
|
Binary file
|
|
Binary file
|
package/test/use-cases/css-and-assets-distribution-via-mini-css-extract-plugin/webpack.config.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
3
|
+
|
|
4
|
+
const WrmPlugin = require('../../../src/WrmPlugin');
|
|
5
|
+
const FRONTEND_SRC_DIR = path.join(__dirname, 'src');
|
|
6
|
+
const OUTPUT_DIR = path.join(__dirname, 'target');
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
mode: 'development',
|
|
10
|
+
devtool: false,
|
|
11
|
+
entry: {
|
|
12
|
+
app: path.join(FRONTEND_SRC_DIR, 'app.js'),
|
|
13
|
+
},
|
|
14
|
+
module: {
|
|
15
|
+
rules: [
|
|
16
|
+
{
|
|
17
|
+
test: /\.(css)$/,
|
|
18
|
+
use: [
|
|
19
|
+
MiniCssExtractPlugin.loader,
|
|
20
|
+
{
|
|
21
|
+
loader: 'css-loader',
|
|
22
|
+
options: {
|
|
23
|
+
modules: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
test: /\.(jpg|png|svg)$/,
|
|
30
|
+
loader: 'file-loader',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
plugins: [
|
|
35
|
+
new WrmPlugin({
|
|
36
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
37
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
38
|
+
verbose: false,
|
|
39
|
+
}),
|
|
40
|
+
new MiniCssExtractPlugin({
|
|
41
|
+
// Options similar to the same options in webpackOptions.output
|
|
42
|
+
// both options are optional
|
|
43
|
+
filename: '[name].css',
|
|
44
|
+
chunkFilename: '[id].css',
|
|
45
|
+
}),
|
|
46
|
+
],
|
|
47
|
+
output: {
|
|
48
|
+
filename: '[name].js',
|
|
49
|
+
path: OUTPUT_DIR,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const assert = require('chai').assert;
|
|
2
|
+
const parse = require('xml-parser');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const targetDir = path.join(__dirname, 'target');
|
|
8
|
+
const webresourceOutput = path.join(targetDir, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml');
|
|
9
|
+
|
|
10
|
+
describe('css-and-assets-via-extract-text-plugin', function() {
|
|
11
|
+
const config = require('./webpack.config.js');
|
|
12
|
+
|
|
13
|
+
let stats;
|
|
14
|
+
let error;
|
|
15
|
+
let entrypoints;
|
|
16
|
+
|
|
17
|
+
const getResourceNodes = webresource => webresource && webresource.children.filter(n => n.name === 'resource');
|
|
18
|
+
|
|
19
|
+
before(done => {
|
|
20
|
+
webpack(config, (err, st) => {
|
|
21
|
+
error = err;
|
|
22
|
+
stats = st;
|
|
23
|
+
|
|
24
|
+
const xmlFile = fs.readFileSync(webresourceOutput, 'utf-8');
|
|
25
|
+
const results = parse(xmlFile);
|
|
26
|
+
entrypoints = results.root.children.filter(n => n.attributes.key.startsWith('entry'));
|
|
27
|
+
done();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should build without failing', () => {
|
|
32
|
+
assert.ok(entrypoints);
|
|
33
|
+
assert.equal(stats.hasErrors(), false);
|
|
34
|
+
assert.equal(stats.hasWarnings(), false);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('for feature one', function() {
|
|
38
|
+
let resources;
|
|
39
|
+
|
|
40
|
+
before(() => {
|
|
41
|
+
let webresource = entrypoints.find(n => n.attributes.key.endsWith('feature-one'));
|
|
42
|
+
resources = getResourceNodes(webresource);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should have three resources', () => {
|
|
46
|
+
assert.equal(resources.length, 3);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should include the feature JS file', () => {
|
|
50
|
+
assert.equal(resources[0].attributes.type, 'download');
|
|
51
|
+
assert.equal(resources[0].attributes.name, 'feature-one.js');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should add the stylesheet to the entry', () => {
|
|
55
|
+
assert.equal(resources[1].attributes.type, 'download');
|
|
56
|
+
assert.equal(resources[1].attributes.name, 'feature-one.css');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should add assets contained within the stylesheet as resources to the entry', () => {
|
|
60
|
+
assert.equal(resources[2].attributes.type, 'download');
|
|
61
|
+
assert.equal(path.extname(resources[2].attributes.name), '.png');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('for feature two', function() {
|
|
66
|
+
let resources;
|
|
67
|
+
|
|
68
|
+
before(() => {
|
|
69
|
+
let webresource = entrypoints.find(n => n.attributes.key.endsWith('feature-two'));
|
|
70
|
+
resources = getResourceNodes(webresource);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should have two resources', () => {
|
|
74
|
+
assert.equal(resources.length, 2);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should include the feature JS file', () => {
|
|
78
|
+
assert.equal(resources[0].attributes.type, 'download');
|
|
79
|
+
assert.equal(resources[0].attributes.name, 'feature-two.js');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should add the stylesheet to the entry', () => {
|
|
83
|
+
assert.equal(resources[1].attributes.type, 'download');
|
|
84
|
+
assert.equal(resources[1].attributes.name, 'feature-two.css');
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './feature-two.css';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
3
|
+
|
|
4
|
+
const WrmPlugin = require('../../../src/WrmPlugin');
|
|
5
|
+
const FRONTEND_SRC_DIR = path.join(__dirname, 'src');
|
|
6
|
+
const OUTPUT_DIR = path.join(__dirname, 'target');
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
mode: 'production',
|
|
10
|
+
entry: {
|
|
11
|
+
'feature-one': path.join(FRONTEND_SRC_DIR, 'feature-one.js'),
|
|
12
|
+
'feature-two': path.join(FRONTEND_SRC_DIR, 'feature-two.js'),
|
|
13
|
+
},
|
|
14
|
+
module: {
|
|
15
|
+
rules: [
|
|
16
|
+
{
|
|
17
|
+
test: /\.(css)$/,
|
|
18
|
+
loader: ExtractTextPlugin.extract({
|
|
19
|
+
fallback: 'style-loader',
|
|
20
|
+
use: {
|
|
21
|
+
loader: 'css-loader',
|
|
22
|
+
options: {
|
|
23
|
+
modules: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
test: /\.(png|svg)$/,
|
|
30
|
+
loader: 'file-loader',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
plugins: [
|
|
35
|
+
new ExtractTextPlugin('[name].css'),
|
|
36
|
+
new WrmPlugin({
|
|
37
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
38
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
39
|
+
verbose: false,
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
output: {
|
|
43
|
+
filename: '[name].js',
|
|
44
|
+
path: OUTPUT_DIR,
|
|
45
|
+
},
|
|
46
|
+
};
|
package/test/use-cases/css-and-assets-via-style-loader/css-and-assets-via-style-loader.test.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const assert = require('chai').assert;
|
|
2
|
+
const parse = require('xml-parser');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const targetDir = path.join(__dirname, 'target');
|
|
8
|
+
const webresourceOutput = path.join(targetDir, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml');
|
|
9
|
+
|
|
10
|
+
describe('css-and-assets-via-style-loader', function() {
|
|
11
|
+
const config = require('./webpack.config.js');
|
|
12
|
+
|
|
13
|
+
let stats;
|
|
14
|
+
let error;
|
|
15
|
+
let assets;
|
|
16
|
+
let resources;
|
|
17
|
+
|
|
18
|
+
beforeEach(done => {
|
|
19
|
+
webpack(config, (err, st) => {
|
|
20
|
+
error = err;
|
|
21
|
+
stats = st;
|
|
22
|
+
|
|
23
|
+
const xmlFile = fs.readFileSync(webresourceOutput, 'utf-8');
|
|
24
|
+
const results = parse(xmlFile);
|
|
25
|
+
assets = results.root.children.find(n => n.attributes.key.startsWith('assets'));
|
|
26
|
+
resources = assets.children.filter(n => n.name === 'resource');
|
|
27
|
+
done();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should create an "asset"-webresource containing the image referenced in the stylesheet', () => {
|
|
32
|
+
assert.ok(assets);
|
|
33
|
+
assert.equal(stats.hasErrors(), false);
|
|
34
|
+
assert.equal(stats.hasWarnings(), false);
|
|
35
|
+
assert.equal(resources[0].attributes.type, 'download');
|
|
36
|
+
assert.equal(path.extname(resources[0].attributes.name), '.png');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should overwrite webpack output path to point to a wrm-resource', () => {
|
|
40
|
+
// setup
|
|
41
|
+
const bundleFile = fs.readFileSync(path.join(targetDir, 'app.js'), 'utf-8');
|
|
42
|
+
const expectedLine = `jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').append(\`<div class="\${_styles_css__WEBPACK_IMPORTED_MODULE_1___default.a.wurst}"><div class="\${_styles_css__WEBPACK_IMPORTED_MODULE_1___default.a.tricky}"></div></div>\`);`;
|
|
43
|
+
|
|
44
|
+
assert.include(bundleFile, expectedLine);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
Binary file
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const WrmPlugin = require('../../../src/WrmPlugin');
|
|
3
|
+
const FRONTEND_SRC_DIR = path.join(__dirname, 'src');
|
|
4
|
+
const OUTPUT_DIR = path.join(__dirname, 'target');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
mode: 'development',
|
|
8
|
+
devtool: false,
|
|
9
|
+
entry: {
|
|
10
|
+
app: path.join(FRONTEND_SRC_DIR, 'app.js'),
|
|
11
|
+
},
|
|
12
|
+
module: {
|
|
13
|
+
rules: [
|
|
14
|
+
{
|
|
15
|
+
test: /\.(css)$/,
|
|
16
|
+
use: [
|
|
17
|
+
{
|
|
18
|
+
loader: 'style-loader',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
loader: 'css-loader',
|
|
22
|
+
options: {
|
|
23
|
+
modules: true,
|
|
24
|
+
localIdentName: '[local]',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
test: /\.(png|svg)$/,
|
|
31
|
+
loader: 'file-loader',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
plugins: [
|
|
36
|
+
new WrmPlugin({
|
|
37
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
38
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
39
|
+
verbose: false,
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
output: {
|
|
43
|
+
filename: '[name].js',
|
|
44
|
+
path: OUTPUT_DIR,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const assert = require('chai').assert;
|
|
2
|
+
const parse = require('xml-parser');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const targetDir = path.join(__dirname, 'target');
|
|
8
|
+
const webresourceOutput = path.join(targetDir, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml');
|
|
9
|
+
|
|
10
|
+
describe('cyclic', function() {
|
|
11
|
+
let config = require('./webpack.config.js');
|
|
12
|
+
|
|
13
|
+
it('compiles an xml file', done => {
|
|
14
|
+
webpack(config, (err, stats) => {
|
|
15
|
+
if (err) {
|
|
16
|
+
throw err;
|
|
17
|
+
}
|
|
18
|
+
assert.equal(stats.hasErrors(), false);
|
|
19
|
+
assert.equal(stats.hasWarnings(), false);
|
|
20
|
+
assert.equal(fs.existsSync(webresourceOutput), true);
|
|
21
|
+
done();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const WrmPlugin = require('../../../src/WrmPlugin');
|
|
3
|
+
const FRONTEND_SRC_DIR = path.resolve(__dirname, 'src');
|
|
4
|
+
const OUTPUT_DIR = path.resolve(__dirname, 'target');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
mode: 'development',
|
|
8
|
+
context: FRONTEND_SRC_DIR,
|
|
9
|
+
entry: {
|
|
10
|
+
'cyclic-entry': path.join(FRONTEND_SRC_DIR, 'root.js'),
|
|
11
|
+
},
|
|
12
|
+
plugins: [
|
|
13
|
+
new WrmPlugin({
|
|
14
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
15
|
+
contextMap: { 'cyclic-entry': [''] },
|
|
16
|
+
xmlDescriptors: path.join(__dirname, 'target', 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
17
|
+
verbose: false,
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
output: {
|
|
21
|
+
filename: '[name].js',
|
|
22
|
+
path: path.resolve(OUTPUT_DIR),
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const assert = require('chai').assert;
|
|
2
|
+
const parse = require('xml-parser');
|
|
3
|
+
const webpack = require('webpack');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const targetDir = path.join(__dirname, 'target');
|
|
8
|
+
const webresourceOutput = path.join(targetDir, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml');
|
|
9
|
+
|
|
10
|
+
describe('data-providers', function() {
|
|
11
|
+
let stats;
|
|
12
|
+
let error;
|
|
13
|
+
let entrypoints;
|
|
14
|
+
|
|
15
|
+
function getEntrypointByKey(key) {
|
|
16
|
+
return entrypoints.find(entrypoint => entrypoint.attributes.key === key);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getDataProviders(entryPointNode) {
|
|
20
|
+
return entryPointNode.children.filter(node => node.name === 'data');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function getDataProviderByKey(dataProvidersNodes, key) {
|
|
24
|
+
return dataProvidersNodes.find(node => node.attributes.key === key);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function runWebpack(config, done) {
|
|
28
|
+
const options = typeof config === 'function' ? config() : config;
|
|
29
|
+
|
|
30
|
+
webpack(options, (err, st) => {
|
|
31
|
+
error = err;
|
|
32
|
+
stats = st;
|
|
33
|
+
|
|
34
|
+
const xmlFile = fs.readFileSync(webresourceOutput, 'utf-8');
|
|
35
|
+
const results = parse(xmlFile);
|
|
36
|
+
entrypoints = results.root.children.filter(n => n.attributes.key.startsWith('entry'));
|
|
37
|
+
done();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function runTheTestsFor(config) {
|
|
42
|
+
beforeEach(done => runWebpack(config, done));
|
|
43
|
+
|
|
44
|
+
it('should generate one data provider for first entry point', () => {
|
|
45
|
+
const entryPointNode = getEntrypointByKey('entrypoint-my-first-entry-point');
|
|
46
|
+
|
|
47
|
+
assert.ok(entryPointNode);
|
|
48
|
+
|
|
49
|
+
const dataProviders = getDataProviders(entryPointNode);
|
|
50
|
+
assert.isArray(dataProviders, 'data providers should be an array');
|
|
51
|
+
assert.lengthOf(dataProviders, 1, 'data providers should include one provider');
|
|
52
|
+
|
|
53
|
+
const dataProvider = getDataProviderByKey(dataProviders, 'first-data-provider');
|
|
54
|
+
|
|
55
|
+
assert.ok(dataProvider);
|
|
56
|
+
|
|
57
|
+
assert.include(
|
|
58
|
+
dataProvider.attributes,
|
|
59
|
+
{ key: 'first-data-provider', class: 'data.provider.JavaClass' },
|
|
60
|
+
'data provider should match given shape'
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should generate two data providers for second entry point', () => {
|
|
65
|
+
const entryPointNode = getEntrypointByKey('entrypoint-my-second-entry-point');
|
|
66
|
+
|
|
67
|
+
assert.ok(entryPointNode);
|
|
68
|
+
|
|
69
|
+
const dataProviders = getDataProviders(entryPointNode);
|
|
70
|
+
assert.isArray(dataProviders, 'data providers should be an array');
|
|
71
|
+
assert.lengthOf(dataProviders, 2, 'data providers should include two providers');
|
|
72
|
+
|
|
73
|
+
const fooDataProvider = getDataProviderByKey(dataProviders, 'foo-data-provider');
|
|
74
|
+
const barDataProvider = getDataProviderByKey(dataProviders, 'bar-data-provider');
|
|
75
|
+
|
|
76
|
+
assert.ok(fooDataProvider);
|
|
77
|
+
assert.ok(barDataProvider);
|
|
78
|
+
|
|
79
|
+
assert.include(
|
|
80
|
+
fooDataProvider.attributes,
|
|
81
|
+
{ key: 'foo-data-provider', class: 'data.provider.FooClass' },
|
|
82
|
+
'foo data provider should match given shape'
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
assert.include(
|
|
86
|
+
barDataProvider.attributes,
|
|
87
|
+
{ key: 'bar-data-provider', class: 'data.provider.BarClass' },
|
|
88
|
+
'bar data provider should match given shape'
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should not generate any data providers for third entry point', () => {
|
|
93
|
+
const entryPointNode = getEntrypointByKey('entrypoint-my-third-entry-point');
|
|
94
|
+
|
|
95
|
+
assert.ok(entryPointNode);
|
|
96
|
+
|
|
97
|
+
const dataProviders = getDataProviders(entryPointNode);
|
|
98
|
+
assert.lengthOf(dataProviders, 0, "data providers shouldn't be defined");
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
describe('using a map', () => {
|
|
103
|
+
const config = require('./webpack.config.with-map.js');
|
|
104
|
+
runTheTestsFor(config);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe('using a plain object', () => {
|
|
108
|
+
const config = require('./webpack.config.js');
|
|
109
|
+
runTheTestsFor(config);
|
|
110
|
+
});
|
|
111
|
+
});
|