@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,33 @@
|
|
|
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
|
+
const providedDependencies = new Map();
|
|
7
|
+
providedDependencies.set('jquery', {
|
|
8
|
+
dependency: 'jira.webresources:jquery',
|
|
9
|
+
import: "require('jquery')",
|
|
10
|
+
});
|
|
11
|
+
providedDependencies.set('underscore', {
|
|
12
|
+
dependency: 'com.atlassian.plugin.jslibs:underscore-1.4.4',
|
|
13
|
+
import: "require('underscore')",
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
mode: 'development',
|
|
18
|
+
entry: {
|
|
19
|
+
app: path.join(FRONTEND_SRC_DIR, 'app.js'),
|
|
20
|
+
},
|
|
21
|
+
plugins: [
|
|
22
|
+
new WrmPlugin({
|
|
23
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
24
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
25
|
+
verbose: false,
|
|
26
|
+
providedDependencies,
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
output: {
|
|
30
|
+
filename: '[name].js',
|
|
31
|
+
path: OUTPUT_DIR,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
const providedDependencies = {
|
|
7
|
+
jquery: {
|
|
8
|
+
dependency: 'jira.webresources:jquery',
|
|
9
|
+
import: "require('jquery')",
|
|
10
|
+
},
|
|
11
|
+
underscore: {
|
|
12
|
+
dependency: 'com.atlassian.plugin.jslibs:underscore-1.4.4',
|
|
13
|
+
import: "require('underscore')",
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
mode: 'development',
|
|
19
|
+
entry: {
|
|
20
|
+
app: path.join(FRONTEND_SRC_DIR, 'app.js'),
|
|
21
|
+
},
|
|
22
|
+
plugins: [
|
|
23
|
+
new WrmPlugin({
|
|
24
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
25
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
26
|
+
verbose: false,
|
|
27
|
+
providedDependencies,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
output: {
|
|
31
|
+
filename: '[name].js',
|
|
32
|
+
path: OUTPUT_DIR,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const chai = require('chai');
|
|
2
|
+
const assert = chai.assert;
|
|
3
|
+
const parse = require('xml-parser');
|
|
4
|
+
const webpack = require('webpack');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
chai.use(require('chai-string'));
|
|
9
|
+
|
|
10
|
+
const targetDir = path.join(__dirname, 'target');
|
|
11
|
+
const webresourceOutput = path.join(targetDir, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml');
|
|
12
|
+
|
|
13
|
+
describe('provided-modules-replacement', function() {
|
|
14
|
+
const config = require('./webpack.config.js');
|
|
15
|
+
|
|
16
|
+
let stats;
|
|
17
|
+
let error;
|
|
18
|
+
let entry;
|
|
19
|
+
let dependencies;
|
|
20
|
+
|
|
21
|
+
function getDependencies(node) {
|
|
22
|
+
return node.children.filter(n => n.name === 'dependency');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getContent(nodes) {
|
|
26
|
+
return nodes.map(n => n.content);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
beforeEach(done => {
|
|
30
|
+
webpack(config, (err, st) => {
|
|
31
|
+
error = err;
|
|
32
|
+
stats = st;
|
|
33
|
+
|
|
34
|
+
const xmlFile = fs.readFileSync(webresourceOutput, 'utf-8');
|
|
35
|
+
const results = parse(xmlFile);
|
|
36
|
+
entry = results.root.children.find(n => n.attributes.key.startsWith('entry'));
|
|
37
|
+
dependencies = getContent(getDependencies(entry));
|
|
38
|
+
done();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should create a webresource with dependencies for each async chunk', () => {
|
|
43
|
+
assert.ok(entry);
|
|
44
|
+
assert.ok(dependencies);
|
|
45
|
+
assert.equal(stats.hasErrors(), false);
|
|
46
|
+
assert.equal(stats.hasWarnings(), false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('add a dependency for the provided module to the webresource', () => {
|
|
50
|
+
assert.include(dependencies, 'jira.webresources:jquery');
|
|
51
|
+
assert.include(dependencies, 'com.atlassian.plugin.jslibs:underscore-1.4.4');
|
|
52
|
+
assert.include(dependencies, 'a.plugin.key:webresource-key');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should specify the provided dependencies as proper amd dependencies', () => {
|
|
56
|
+
// setup
|
|
57
|
+
const bundleFile = fs.readFileSync(path.join(targetDir, 'app.js'), 'utf-8');
|
|
58
|
+
const bundleLines = bundleFile.split('\n');
|
|
59
|
+
|
|
60
|
+
assert.startsWith(bundleLines[0], `define(["jquery","underscore"],`);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const WrmPlugin = require('../../../src/WrmPlugin');
|
|
4
|
+
const FRONTEND_SRC_DIR = path.join(__dirname, 'src');
|
|
5
|
+
const OUTPUT_DIR = path.join(__dirname, 'target');
|
|
6
|
+
|
|
7
|
+
const providedDependencies = new Map();
|
|
8
|
+
providedDependencies.set('jquery', {
|
|
9
|
+
dependency: 'jira.webresources:jquery',
|
|
10
|
+
import: {
|
|
11
|
+
var: "require('jquery')",
|
|
12
|
+
amd: 'jquery',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
providedDependencies.set('underscore', {
|
|
16
|
+
dependency: 'com.atlassian.plugin.jslibs:underscore-1.4.4',
|
|
17
|
+
import: {
|
|
18
|
+
var: "require('underscore')",
|
|
19
|
+
amd: 'underscore',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
mode: 'development',
|
|
25
|
+
entry: {
|
|
26
|
+
app: path.join(FRONTEND_SRC_DIR, 'app.js'),
|
|
27
|
+
},
|
|
28
|
+
plugins: [
|
|
29
|
+
new WrmPlugin({
|
|
30
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
31
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
32
|
+
verbose: false,
|
|
33
|
+
providedDependencies,
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
output: {
|
|
37
|
+
filename: '[name].js',
|
|
38
|
+
path: OUTPUT_DIR,
|
|
39
|
+
libraryTarget: 'amd',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
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('qunit-test-wrm-web-resource', function() {
|
|
11
|
+
this.timeout(10000);
|
|
12
|
+
const config = require('./webpack.config.js');
|
|
13
|
+
|
|
14
|
+
let stats;
|
|
15
|
+
let entry1;
|
|
16
|
+
let entry2;
|
|
17
|
+
let testEntry1;
|
|
18
|
+
let testEntry2;
|
|
19
|
+
let qunitResources;
|
|
20
|
+
|
|
21
|
+
function getDependencies(node) {
|
|
22
|
+
return node.children.filter(n => n.name === 'dependency');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getResources(node) {
|
|
26
|
+
return node.children.filter(n => n.name === 'resource');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getContent(nodes) {
|
|
30
|
+
return nodes.map(n => n.content);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getName(nodes) {
|
|
34
|
+
return nodes.map(n => n.attributes.name);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
before(done => {
|
|
38
|
+
webpack(config, (err, st) => {
|
|
39
|
+
stats = st;
|
|
40
|
+
|
|
41
|
+
const xmlFile = fs.readFileSync(webresourceOutput, 'utf-8');
|
|
42
|
+
const results = parse(xmlFile);
|
|
43
|
+
[entry1, entry2] = results.root.children.filter(
|
|
44
|
+
n => n.attributes.key && n.attributes.key.startsWith('entrypoint')
|
|
45
|
+
);
|
|
46
|
+
[testEntry1, testEntry2] = results.root.children.filter(
|
|
47
|
+
n => n.attributes.key && n.attributes.key.startsWith('__test__entrypoint')
|
|
48
|
+
);
|
|
49
|
+
qunitResources = results.root.children.filter(n => n.attributes.type === 'qunit');
|
|
50
|
+
done();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should create an xml file without errors', () => {
|
|
55
|
+
// check
|
|
56
|
+
assert.equal(stats.hasErrors(), false, 'should not have errors');
|
|
57
|
+
assert.equal(stats.hasWarnings(), false, 'should not have warnings');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should create a "normal" and a "test" web-resource per entry', () => {
|
|
61
|
+
// check
|
|
62
|
+
assert.ok(entry1, 'entry1 does not exist');
|
|
63
|
+
assert.ok(entry2, 'entry2 does not exist');
|
|
64
|
+
assert.ok(testEntry1, 'testEntry1 does not exist');
|
|
65
|
+
assert.ok(testEntry2, 'testEntry2 does not exist');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should create qunit-resource entries per found test file - as specified by the glob', () => {
|
|
69
|
+
// setup
|
|
70
|
+
const [barResource, fooResource] = getName(qunitResources);
|
|
71
|
+
|
|
72
|
+
// check
|
|
73
|
+
assert.equal(qunitResources.length, 2, 'qunit resources not found');
|
|
74
|
+
assert.equal(
|
|
75
|
+
barResource,
|
|
76
|
+
'test/use-cases/qunit-test-wrm-web-resource/src/bar-dep_test.js',
|
|
77
|
+
'expected to find qunit resources for bar-dep.js'
|
|
78
|
+
);
|
|
79
|
+
assert.equal(
|
|
80
|
+
fooResource,
|
|
81
|
+
'test/use-cases/qunit-test-wrm-web-resource/src/foo-dep_test.js',
|
|
82
|
+
'expected to find qunit resources for foo-dep.js'
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('test web-resources', () => {
|
|
87
|
+
it('should contain dependencies as found in their respective entries', () => {
|
|
88
|
+
// setup
|
|
89
|
+
const deps1 = getContent(getDependencies(testEntry1));
|
|
90
|
+
const deps2 = getContent(getDependencies(testEntry2));
|
|
91
|
+
|
|
92
|
+
// check
|
|
93
|
+
assert.include(deps1, 'some.weird:web-resource');
|
|
94
|
+
assert.include(deps1, 'foo-bar:baz');
|
|
95
|
+
assert.include(deps2, 'some.weird:web-resource');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should contain a mock-require as the first file dependency per entry', () => {
|
|
99
|
+
// setup
|
|
100
|
+
const actualFirstResource1 = getName([getResources(testEntry1)[0]])[0];
|
|
101
|
+
const actualFirstResource2 = getName([getResources(testEntry2)[0]])[0];
|
|
102
|
+
const expectedFirstResource = 'qunit-require-shim-DEV_PSEUDO_HASH.js';
|
|
103
|
+
|
|
104
|
+
// check
|
|
105
|
+
assert.equal(
|
|
106
|
+
actualFirstResource1,
|
|
107
|
+
expectedFirstResource,
|
|
108
|
+
'unexpected first file in test entry 1 - expected require mock'
|
|
109
|
+
);
|
|
110
|
+
assert.equal(
|
|
111
|
+
actualFirstResource2,
|
|
112
|
+
expectedFirstResource,
|
|
113
|
+
'unexpected first file in test entry 2 - expected require mock'
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should not contain the files from another entry', () => {
|
|
118
|
+
// setup
|
|
119
|
+
const actualFirstResource1 = getName(getResources(testEntry1));
|
|
120
|
+
const actualFirstResource2 = getName(getResources(testEntry2));
|
|
121
|
+
const expectedOnlyInEntry1 = 'test/use-cases/qunit-test-wrm-web-resource/src/app.js';
|
|
122
|
+
const expectedOnlyInEntry2 = 'test/use-cases/qunit-test-wrm-web-resource/src/app.2.js';
|
|
123
|
+
|
|
124
|
+
// check
|
|
125
|
+
assert.include(actualFirstResource1, expectedOnlyInEntry1, 'missing resource in first entry');
|
|
126
|
+
assert.include(actualFirstResource2, expectedOnlyInEntry2, 'missing resource in second entry');
|
|
127
|
+
assert.notInclude(actualFirstResource1, expectedOnlyInEntry2, 'unexpected resource in second entry');
|
|
128
|
+
assert.notInclude(actualFirstResource2, expectedOnlyInEntry1, 'unexpected resource in second entry');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('should only contain the files contained in the respective entrypoint', () => {
|
|
132
|
+
// setup
|
|
133
|
+
const actualResources1 = getName(getResources(testEntry1));
|
|
134
|
+
const actualResources2 = getName(getResources(testEntry2));
|
|
135
|
+
const expectedResources1 = [
|
|
136
|
+
'qunit-require-shim-DEV_PSEUDO_HASH.js',
|
|
137
|
+
'ultimate/name/at/runtime.js',
|
|
138
|
+
'test/use-cases/qunit-test-wrm-web-resource/src/bar-dep.js',
|
|
139
|
+
'ultimate/name/at/runtime.css',
|
|
140
|
+
'test/use-cases/qunit-test-wrm-web-resource/src/foo-dep.js',
|
|
141
|
+
'test/use-cases/qunit-test-wrm-web-resource/src/app.js',
|
|
142
|
+
'very_async_less.less',
|
|
143
|
+
'test/use-cases/qunit-test-wrm-web-resource/src/foo-async.js',
|
|
144
|
+
];
|
|
145
|
+
const expectedResources2 = [
|
|
146
|
+
'qunit-require-shim-DEV_PSEUDO_HASH.js',
|
|
147
|
+
'ultimate/name/at/runtime.js',
|
|
148
|
+
'test/use-cases/qunit-test-wrm-web-resource/src/bar-dep.js',
|
|
149
|
+
'test/use-cases/qunit-test-wrm-web-resource/src/app.2.js',
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
// check
|
|
153
|
+
assert.deepEqual(actualResources1, expectedResources1, 'unexpected files in test resources for entry 1');
|
|
154
|
+
assert.deepEqual(actualResources2, expectedResources2, 'unexpected files in test resources for entry 2');
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import 'wr-dependency!some.weird:web-resource';
|
|
3
|
+
import 'wr-resource!ultimate/name/at/runtime.js!path/to/my/template.soy';
|
|
4
|
+
|
|
5
|
+
export default () => {
|
|
6
|
+
// the MySoyTemplateNamespace would be provided via the soy file. It's currently a side-effect of its generation.
|
|
7
|
+
document.body.innerHTML = MySoyTemplateNamespace.Example.sayHello({ name: 'world' });
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// nothing
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// nothing
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
entry: {
|
|
9
|
+
app: path.join(FRONTEND_SRC_DIR, 'app.js'),
|
|
10
|
+
app2: path.join(FRONTEND_SRC_DIR, 'app.2.js'),
|
|
11
|
+
},
|
|
12
|
+
plugins: [
|
|
13
|
+
new WrmPlugin({
|
|
14
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
15
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
16
|
+
verbose: false,
|
|
17
|
+
__testGlobs__: ['**/qunit-test-wrm-web-resource/src/*_test.js'],
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
output: {
|
|
21
|
+
filename: '[name].js',
|
|
22
|
+
path: OUTPUT_DIR,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
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('resource-parameters', function() {
|
|
11
|
+
const config = require('./webpack.config.js');
|
|
12
|
+
|
|
13
|
+
const byExtension = (resources, ext) => resources.filter(r => r.attributes.name.endsWith(ext))[0];
|
|
14
|
+
|
|
15
|
+
let stats;
|
|
16
|
+
let assets;
|
|
17
|
+
let resources;
|
|
18
|
+
|
|
19
|
+
beforeEach(done => {
|
|
20
|
+
webpack(config, (err, st) => {
|
|
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 add a param to a resource', () => {
|
|
32
|
+
assert.ok(assets);
|
|
33
|
+
assert.equal(stats.hasErrors(), false);
|
|
34
|
+
assert.equal(stats.hasWarnings(), false);
|
|
35
|
+
assert.equal(resources.length, 3);
|
|
36
|
+
|
|
37
|
+
const png = byExtension(resources, '.png');
|
|
38
|
+
assert.equal(path.extname(png.attributes.name), '.png');
|
|
39
|
+
assert.equal(png.children.length, 1, 'should contain a "param" child.');
|
|
40
|
+
assert.equal(png.children[0].attributes.name, 'bar', 'Type of param.');
|
|
41
|
+
assert.equal(png.children[0].attributes.value, 'baz', 'Value of param.');
|
|
42
|
+
const svg = byExtension(resources, '.svg');
|
|
43
|
+
assert.equal(svg.attributes.type, 'download');
|
|
44
|
+
assert.equal(svg.children.length, 2, 'should contain two "param" children.');
|
|
45
|
+
assert.equal(svg.children[0].attributes.name, 'content-type', 'Type of param.');
|
|
46
|
+
assert.equal(svg.children[0].attributes.value, 'image/svg+xml', 'Value of param.');
|
|
47
|
+
assert.equal(svg.children[1].attributes.name, 'foo', 'Type of param.');
|
|
48
|
+
assert.equal(svg.children[1].attributes.value, 'bar', 'Value of param.');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should include the last defined value for a given parameter', () => {
|
|
52
|
+
const jpg = byExtension(resources, '.jpg');
|
|
53
|
+
assert.equal(jpg.children.length, 2, 'should contain "param" children.');
|
|
54
|
+
assert.equal(jpg.children[0].attributes.name, 'bar');
|
|
55
|
+
assert.equal(jpg.children[1].attributes.name, 'duped');
|
|
56
|
+
assert.equal(jpg.children[1].attributes.value, 'second', 'Last declared value should win.');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should add image/svg+xml by default for svg files', done => {
|
|
60
|
+
const svgConfig = require('./webpack.svg.config');
|
|
61
|
+
webpack(svgConfig, (err, st) => {
|
|
62
|
+
stats = st;
|
|
63
|
+
|
|
64
|
+
const xmlFile = fs.readFileSync(webresourceOutput, 'utf-8');
|
|
65
|
+
const results = parse(xmlFile);
|
|
66
|
+
assets = results.root.children.find(n => n.attributes.key.startsWith('assets'));
|
|
67
|
+
resources = assets.children.filter(n => n.name === 'resource');
|
|
68
|
+
|
|
69
|
+
const svg = byExtension(resources, '.svg');
|
|
70
|
+
assert.equal(svg.attributes.type, 'download');
|
|
71
|
+
assert.equal(svg.children.length, 1, 'should contain a "param" child.');
|
|
72
|
+
assert.equal(svg.children[0].attributes.name, 'content-type', 'Type of param.');
|
|
73
|
+
assert.equal(svg.children[0].attributes.value, 'image/svg+xml', 'Value of param.');
|
|
74
|
+
done();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import logo from './ice.png';
|
|
2
|
+
import logo2 from './rect.svg';
|
|
3
|
+
import logo3 from './ice2.jpg';
|
|
4
|
+
|
|
5
|
+
const image = new Image();
|
|
6
|
+
image.src = logo;
|
|
7
|
+
|
|
8
|
+
const image2 = new Image();
|
|
9
|
+
image2.src = logo2;
|
|
10
|
+
|
|
11
|
+
const image3 = new Image();
|
|
12
|
+
image3.src = logo3;
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
entry: {
|
|
9
|
+
app: path.join(FRONTEND_SRC_DIR, 'app.js'),
|
|
10
|
+
},
|
|
11
|
+
module: {
|
|
12
|
+
rules: [
|
|
13
|
+
{
|
|
14
|
+
test: /\.(png|svg|jpg)$/,
|
|
15
|
+
loader: 'file-loader',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
plugins: [
|
|
20
|
+
new WrmPlugin({
|
|
21
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
22
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
23
|
+
verbose: false,
|
|
24
|
+
resourceParamMap: {
|
|
25
|
+
svg: [
|
|
26
|
+
{
|
|
27
|
+
name: 'content-type',
|
|
28
|
+
value: 'image/svg+xml',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'foo',
|
|
32
|
+
value: 'bar',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
png: [
|
|
36
|
+
{
|
|
37
|
+
name: 'bar',
|
|
38
|
+
value: 'baz',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
jpg: [
|
|
42
|
+
{
|
|
43
|
+
name: 'duped',
|
|
44
|
+
value: 'first',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'bar',
|
|
48
|
+
value: 'baz',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'duped',
|
|
52
|
+
value: 'second',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
],
|
|
58
|
+
output: {
|
|
59
|
+
filename: '[name].js',
|
|
60
|
+
path: OUTPUT_DIR,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
entry: {
|
|
9
|
+
app: path.join(FRONTEND_SRC_DIR, 'app.js'),
|
|
10
|
+
},
|
|
11
|
+
module: {
|
|
12
|
+
rules: [
|
|
13
|
+
{
|
|
14
|
+
test: /\.(png|svg)$/,
|
|
15
|
+
loader: 'file-loader',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
plugins: [
|
|
20
|
+
new WrmPlugin({
|
|
21
|
+
pluginKey: 'com.atlassian.plugin.test',
|
|
22
|
+
xmlDescriptors: path.join(OUTPUT_DIR, 'META-INF', 'plugin-descriptor', 'wr-webpack-bundles.xml'),
|
|
23
|
+
verbose: false,
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
output: {
|
|
27
|
+
filename: '[name].js',
|
|
28
|
+
path: OUTPUT_DIR,
|
|
29
|
+
},
|
|
30
|
+
};
|