@ui5/webcomponents-tools 0.0.0-453158269 → 0.0.0-47cc17a26
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/CHANGELOG.md +2086 -0
- package/LICENSE.txt +201 -0
- package/README.md +7 -10
- package/assets-meta.js +12 -11
- package/bin/dev.js +3 -6
- package/bin/ui5nps.js +265 -0
- package/components-package/eslint.js +66 -2
- package/components-package/nps.js +148 -69
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -26
- package/components-package/vite.config.js +9 -0
- package/components-package/wdio.js +69 -17
- package/icons-collection/nps.js +32 -18
- package/lib/amd-to-es6/index.js +107 -0
- package/lib/amd-to-es6/no-remaining-require.js +33 -0
- package/lib/cem/cem.js +12 -0
- package/lib/cem/custom-elements-manifest.config.mjs +530 -0
- package/lib/cem/event.mjs +168 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/cli.js +128 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/package.json +59 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/browser-entrypoint.js +23 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/create.js +117 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/arrow-function.js +26 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/class-jsdoc.js +157 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/classes.js +20 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createArrowFunction.js +17 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createAttribute.js +24 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createClass.js +301 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createClassField.js +26 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createFunctionLike.js +73 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createMixin.js +33 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createVariable.js +22 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/handlers.js +338 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/custom-elements-define-calls.js +90 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/exports.js +156 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/function-like.js +24 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/mixins.js +29 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/reexported-wrapped-mixin-exports.js +84 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/variables.js +34 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/collect-phase/collect-imports.js +101 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst/catalyst.js +11 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst/controller.js +34 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst-major-2/catalyst.js +11 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst-major-2/controller.js +34 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/decorators/attr.js +53 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/decorators/custom-element-decorator.js +36 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/fast/fast.js +7 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/lit.js +13 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/member-denylist.js +21 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/method-denylist.js +20 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/property-decorator.js +94 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/static-properties.js +121 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/utils.js +66 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/stencil/stencil.js +129 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/index.js +80 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/cleanup-classes.js +25 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/field-denylist.js +22 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/method-denylist.js +25 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/apply-inheritance.js +78 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/is-custom-element.js +34 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/link-class-to-tagname.js +27 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/remove-unexported-declarations.js +23 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/resolve-initializers.js +52 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/ast-helpers.js +186 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/cli-helpers.js +164 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/exports.js +44 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/find-external-manifests.js +67 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/imports.js +25 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/index.js +71 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/jsdoc.js +19 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/manifest-helpers.js +194 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/mixins.js +112 -0
- package/lib/cem/schema-internal.json +1422 -0
- package/lib/cem/schema.json +1098 -0
- package/lib/cem/types-internal.d.ts +808 -0
- package/lib/cem/types.d.ts +736 -0
- package/lib/cem/utils.mjs +423 -0
- package/lib/cem/validate.js +76 -0
- package/lib/copy-and-watch/index.js +105 -97
- package/lib/copy-list/index.js +16 -10
- package/lib/create-icons/index.js +74 -25
- package/lib/create-illustrations/index.js +88 -45
- package/lib/create-new-component/Component.js +74 -0
- package/lib/create-new-component/ComponentTemplate.js +12 -0
- package/lib/create-new-component/index.js +62 -101
- package/lib/css-processors/css-processor-components.mjs +92 -0
- package/lib/css-processors/css-processor-themes.mjs +102 -0
- package/lib/css-processors/scope-variables.mjs +49 -0
- package/lib/css-processors/shared.mjs +46 -0
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/dev-server/dev-server.mjs +78 -0
- package/lib/dev-server/virtual-index-html-plugin.js +56 -0
- package/lib/generate-js-imports/illustrations.js +85 -0
- package/lib/generate-json-imports/i18n.js +62 -69
- package/lib/generate-json-imports/themes.js +34 -43
- package/lib/hbs2lit/src/compiler.js +16 -5
- package/lib/hbs2lit/src/litVisitor2.js +85 -22
- package/lib/hbs2lit/src/svgProcessor.js +12 -5
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
- package/lib/hbs2ui5/index.js +23 -6
- package/lib/i18n/defaults.js +30 -8
- package/lib/i18n/toJSON.js +15 -11
- package/lib/icons-hash/icons-hash.mjs +149 -0
- package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
- package/lib/remove-dev-mode/remove-dev-mode.mjs +51 -0
- package/lib/rimraf/rimraf.js +31 -0
- package/lib/scoping/get-all-tags.js +11 -11
- package/lib/scoping/lint-src.js +8 -7
- package/lib/scoping/scope-test-pages.js +2 -1
- package/lib/test-runner/test-runner.js +71 -0
- package/package.json +45 -33
- package/tsconfig.json +18 -0
- package/components-package/rollup-plugins/empty-module.js +0 -15
- package/components-package/rollup.js +0 -150
- package/components-package/wdio.sync.js +0 -360
- package/lib/documentation/index.js +0 -168
- package/lib/documentation/templates/api-component-since.js +0 -3
- package/lib/documentation/templates/api-css-variables-section.js +0 -24
- package/lib/documentation/templates/api-events-section.js +0 -35
- package/lib/documentation/templates/api-methods-section.js +0 -26
- package/lib/documentation/templates/api-properties-section.js +0 -42
- package/lib/documentation/templates/api-slots-section.js +0 -28
- package/lib/documentation/templates/template.js +0 -39
- package/lib/esm-abs-to-rel/index.js +0 -58
- package/lib/jsdoc/config.json +0 -29
- package/lib/jsdoc/plugin.js +0 -2436
- package/lib/jsdoc/template/publish.js +0 -4112
- package/lib/postcss-css-to-esm/index.js +0 -45
- package/lib/postcss-css-to-json/index.js +0 -36
- package/lib/postcss-new-files/index.js +0 -36
- package/lib/postcss-p/postcss-p.mjs +0 -11
- package/lib/replace-global-core/index.js +0 -25
- package/lib/serve/index.js +0 -46
- package/lib/serve/serve.json +0 -3
- package/package-lock.json +0 -48
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const child_process = require("child_process");
|
|
2
|
+
const { readFileSync } = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
// search for dev-server port
|
|
7
|
+
// start in current folder
|
|
8
|
+
// traversing upwards in case of mono repo tests and dev-server running in root folder of repository
|
|
9
|
+
let devServerFolder = process.cwd();
|
|
10
|
+
let devServerPort;
|
|
11
|
+
while (true) {
|
|
12
|
+
try {
|
|
13
|
+
devServerPort = readFileSync(path.join(devServerFolder, ".dev-server-port")).toString();
|
|
14
|
+
break; // found
|
|
15
|
+
} catch (e) {
|
|
16
|
+
// file not found
|
|
17
|
+
if (devServerFolder === path.dirname(devServerFolder)) {
|
|
18
|
+
break; // reached root folder "/"
|
|
19
|
+
}
|
|
20
|
+
devServerFolder = path.dirname(devServerFolder);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// check if we are in a monorepo and extract path from package.json
|
|
25
|
+
let packageRepositoryPath = "";
|
|
26
|
+
const pkg = require(path.join(process.cwd(), "package.json"));
|
|
27
|
+
packageRepositoryPath = pkg.repository ? pkg.repository.directory : "";
|
|
28
|
+
|
|
29
|
+
// construct base url
|
|
30
|
+
// use devServerPort if a dev server is running, otherwise let the baseUrl in the wdio config be used
|
|
31
|
+
// if a dev server is running in the root of a mono repo, append tha package path like this
|
|
32
|
+
// http://localhost:${devServerPort}/packages/main/
|
|
33
|
+
let baseUrl = "";
|
|
34
|
+
if (devServerPort) {
|
|
35
|
+
console.log(`Found port ${devServerPort} from '${path.join(devServerFolder, ".dev-server-port")}'`);
|
|
36
|
+
const devServerInRoot = !devServerFolder.includes(packageRepositoryPath);
|
|
37
|
+
if (devServerInRoot) {
|
|
38
|
+
baseUrl = `--base-url http://localhost:${devServerPort}/${packageRepositoryPath}/`;
|
|
39
|
+
} else {
|
|
40
|
+
baseUrl = `--base-url http://localhost:${devServerPort}/`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!baseUrl) {
|
|
45
|
+
console.log("No dev server running, running tests served from `dist`, make sure it is up to date");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// add single spec parameter if passed
|
|
49
|
+
let spec = "";
|
|
50
|
+
if (process.argv.length === 3) {
|
|
51
|
+
const specFile = process.argv[2];
|
|
52
|
+
spec = `--spec ${specFile}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// more parameters - pass them to wdio
|
|
56
|
+
let restParams = "";
|
|
57
|
+
if (process.argv.length > 3) {
|
|
58
|
+
restParams = process.argv.slice(2).join(" ");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let wdioConfig = "";
|
|
62
|
+
if (fs.existsSync("config/wdio.conf.cjs")) {
|
|
63
|
+
wdioConfig = "config/wdio.conf.cjs";
|
|
64
|
+
} else if (fs.existsSync("config/wdio.conf.js")) {
|
|
65
|
+
wdioConfig = "config/wdio.conf.js";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// run wdio with calculated parameters
|
|
69
|
+
const cmd = `yarn cross-env WDIO_LOG_LEVEL=error wdio ${wdioConfig} ${spec} ${baseUrl} ${restParams}`;
|
|
70
|
+
console.log(`executing: ${cmd}`);
|
|
71
|
+
child_process.execSync(cmd, {stdio: 'inherit'});
|
package/package.json
CHANGED
|
@@ -1,76 +1,88 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-47cc17a26",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
-
"private": false,
|
|
8
7
|
"keywords": [
|
|
9
8
|
"openui5",
|
|
10
9
|
"sapui5",
|
|
11
10
|
"ui5"
|
|
12
11
|
],
|
|
13
|
-
"scripts": {},
|
|
14
12
|
"bin": {
|
|
15
|
-
"
|
|
16
|
-
"wc-create-ui5-element": "bin/create-ui5-element.js"
|
|
13
|
+
"ui5nps": "bin/ui5nps.js",
|
|
14
|
+
"wc-create-ui5-element": "bin/create-ui5-element.js",
|
|
15
|
+
"wc-dev": "bin/dev.js"
|
|
17
16
|
},
|
|
18
17
|
"repository": {
|
|
19
18
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/
|
|
19
|
+
"url": "https://github.com/UI5/webcomponents.git",
|
|
21
20
|
"directory": "packages/tools"
|
|
22
21
|
},
|
|
23
22
|
"dependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"@wdio/cli": "^7.
|
|
28
|
-
"@wdio/
|
|
29
|
-
"@wdio/
|
|
30
|
-
"@wdio/
|
|
31
|
-
"@wdio/
|
|
32
|
-
"@wdio/
|
|
23
|
+
"@custom-elements-manifest/analyzer": "^0.10.10",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
|
25
|
+
"@typescript-eslint/parser": "^6.9.0",
|
|
26
|
+
"@wdio/cli": "^7.19.7",
|
|
27
|
+
"@wdio/dot-reporter": "^7.19.7",
|
|
28
|
+
"@wdio/local-runner": "^7.19.7",
|
|
29
|
+
"@wdio/mocha-framework": "^7.19.7",
|
|
30
|
+
"@wdio/spec-reporter": "^7.19.7",
|
|
31
|
+
"@wdio/static-server-service": "^7.19.5",
|
|
32
|
+
"ajv": "^8.12.0",
|
|
33
|
+
"cem-plugin-vs-code-custom-data-generator": "^1.4.2",
|
|
33
34
|
"chai": "^4.3.4",
|
|
34
35
|
"child_process": "^1.0.2",
|
|
35
|
-
"chokidar": "^3.
|
|
36
|
+
"chokidar": "^3.6.0",
|
|
36
37
|
"chokidar-cli": "^3.0.0",
|
|
37
|
-
"cli-color": "^2.0.1",
|
|
38
38
|
"command-line-args": "^5.1.1",
|
|
39
|
-
"
|
|
39
|
+
"comment-parser": "^1.4.0",
|
|
40
40
|
"cross-env": "^7.0.3",
|
|
41
|
-
"
|
|
41
|
+
"custom-element-jet-brains-integration": "^1.4.4",
|
|
42
|
+
"dotenv": "^16.5.0",
|
|
42
43
|
"escodegen": "^2.0.0",
|
|
43
44
|
"eslint": "^7.22.0",
|
|
44
45
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
45
|
-
"eslint-plugin-import": "^2.
|
|
46
|
+
"eslint-plugin-import": "^2.31.0",
|
|
47
|
+
"eslint-plugin-jsx-no-leaked-values": "^0.1.24",
|
|
46
48
|
"esprima": "^4.0.1",
|
|
47
49
|
"getopts": "^2.3.0",
|
|
48
50
|
"glob": "^7.1.6",
|
|
49
51
|
"glob-parent": "^6.0.2",
|
|
50
52
|
"globby": "^13.1.1",
|
|
51
53
|
"handlebars": "^4.7.7",
|
|
54
|
+
"ignore": "^7.0.5",
|
|
52
55
|
"is-port-reachable": "^3.1.0",
|
|
53
|
-
"jsdoc": "^3.6.6",
|
|
54
56
|
"json-beautify": "^1.1.1",
|
|
55
57
|
"mkdirp": "^1.0.4",
|
|
56
|
-
"nps": "^5.10.0",
|
|
57
58
|
"postcss": "^8.4.5",
|
|
58
59
|
"postcss-cli": "^9.1.0",
|
|
59
|
-
"postcss-import": "^14.0.2",
|
|
60
60
|
"postcss-selector-parser": "^6.0.10",
|
|
61
|
+
"prompts": "^2.4.2",
|
|
61
62
|
"properties-reader": "^2.2.0",
|
|
62
63
|
"recursive-readdir": "^2.2.2",
|
|
63
64
|
"resolve": "^1.20.0",
|
|
64
|
-
"rimraf": "^3.0.2",
|
|
65
|
-
"rollup": "^2.41.4",
|
|
66
|
-
"rollup-plugin-livereload": "^2.0.0",
|
|
67
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
68
|
-
"serve": "^12.0.0",
|
|
69
65
|
"slash": "3.0.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
66
|
+
"string-argv": "^0.3.2",
|
|
67
|
+
"vite": "^5.4.8",
|
|
68
|
+
"vite-plugin-istanbul": "^6.0.2",
|
|
69
|
+
"wdio-chromedriver-service": "^7.3.2"
|
|
72
70
|
},
|
|
73
71
|
"peerDependencies": {
|
|
74
|
-
"chromedriver": "*"
|
|
75
|
-
|
|
76
|
-
}
|
|
72
|
+
"chromedriver": "*",
|
|
73
|
+
"typescript": "^5.6.2"
|
|
74
|
+
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"typescript": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"engines": {
|
|
81
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"esbuild": "^0.25.0",
|
|
85
|
+
"yargs": "^17.5.1"
|
|
86
|
+
},
|
|
87
|
+
"gitHead": "42ca8b3af7963e8f6d8269fdcaf26052a1b14cab"
|
|
88
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2021",
|
|
4
|
+
"lib": [
|
|
5
|
+
"DOM",
|
|
6
|
+
"DOM.Iterable",
|
|
7
|
+
"ES2023"
|
|
8
|
+
],
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"inlineSources": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"moduleResolution": "node",
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
"jsxImportSource": "@ui5/webcomponents-base",
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const slash = require("slash");
|
|
2
|
-
|
|
3
|
-
function emptyModulePlugin({ emptyModules }) {
|
|
4
|
-
return {
|
|
5
|
-
name: "ui5-dev-empty-module-plugin",
|
|
6
|
-
load(id) {
|
|
7
|
-
if (emptyModules.some(mod => slash(id).includes(mod))) {
|
|
8
|
-
return `export default ""`;
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports = emptyModulePlugin;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
const process = require("process");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const os = require("os");
|
|
4
|
-
const { nodeResolve } = require("@rollup/plugin-node-resolve");
|
|
5
|
-
const { terser } = require("rollup-plugin-terser");
|
|
6
|
-
const json = require("@rollup/plugin-json");
|
|
7
|
-
const replace = require("@rollup/plugin-replace");
|
|
8
|
-
const colors = require("cli-color");
|
|
9
|
-
const livereload = require("rollup-plugin-livereload");
|
|
10
|
-
const emptyModulePlugin = require("./rollup-plugins/empty-module.js");
|
|
11
|
-
|
|
12
|
-
const packageFile = JSON.parse(fs.readFileSync("./package.json"));
|
|
13
|
-
const packageName = packageFile.name;
|
|
14
|
-
|
|
15
|
-
const warningsToSkip = [{
|
|
16
|
-
warningCode: "THIS_IS_UNDEFINED",
|
|
17
|
-
filePath: /.+zxing.+/,
|
|
18
|
-
}];
|
|
19
|
-
|
|
20
|
-
function ui5DevImportCheckerPlugin() {
|
|
21
|
-
return {
|
|
22
|
-
name: "ui5-dev-import-checker-plugin",
|
|
23
|
-
transform(code, file) {
|
|
24
|
-
const re = new RegExp(`^import.*"${packageName}/`);
|
|
25
|
-
if (re.test(code)) {
|
|
26
|
-
throw new Error(`illegal import in ${file}`);
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function onwarn(warning, warn) {
|
|
33
|
-
// Skip warning for known false positives that will otherwise polute the log
|
|
34
|
-
let skip = warningsToSkip.find(warningToSkip => {
|
|
35
|
-
let loc, file;
|
|
36
|
-
return warning.code === warningToSkip.warningCode
|
|
37
|
-
&& (loc = warning.loc)
|
|
38
|
-
&& (file = loc.file)
|
|
39
|
-
&& file.match(warningToSkip.filePath);
|
|
40
|
-
});
|
|
41
|
-
if (skip) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// warn everything else
|
|
46
|
-
warn( warning );
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const reportedForPackages = new Set(); // sometimes writeBundle is called more than once per bundle -> suppress extra messages
|
|
50
|
-
function ui5DevReadyMessagePlugin() {
|
|
51
|
-
return {
|
|
52
|
-
name: "ui5-dev-message-ready-plugin",
|
|
53
|
-
writeBundle: (assets, bundle) => {
|
|
54
|
-
if (reportedForPackages.has(packageName)) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
console.log(colors.blue(`${colors.bold(packageName)} successfully built!`));
|
|
58
|
-
|
|
59
|
-
if (fs.existsSync(".port")) {
|
|
60
|
-
const port = `${fs.readFileSync(".port")}`;
|
|
61
|
-
if (port) {
|
|
62
|
-
console.log(colors.blue(`Navigate to: ${colors.bold(`http://localhost:${port}/test-resources/pages/`)}`));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
reportedForPackages.add(packageName);
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const getPlugins = () => {
|
|
71
|
-
const plugins = [];
|
|
72
|
-
|
|
73
|
-
if (process.env.DEV) {
|
|
74
|
-
plugins.push(replace({
|
|
75
|
-
values: {
|
|
76
|
-
'const DEV_MODE = false': 'const DEV_MODE = true',
|
|
77
|
-
},
|
|
78
|
-
preventAssignment: false,
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (process.env.DEV && !process.env.ENABLE_CLDR) {
|
|
83
|
-
// Empty the CLDR assets file for better performance during development
|
|
84
|
-
plugins.push(emptyModulePlugin({
|
|
85
|
-
emptyModules: [
|
|
86
|
-
"localization/dist/Assets.js",
|
|
87
|
-
],
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
plugins.push(ui5DevImportCheckerPlugin());
|
|
92
|
-
|
|
93
|
-
plugins.push(json({
|
|
94
|
-
include: [
|
|
95
|
-
/.*assets\/.*\.json/,
|
|
96
|
-
],
|
|
97
|
-
namedExports: false,
|
|
98
|
-
}));
|
|
99
|
-
|
|
100
|
-
plugins.push(nodeResolve());
|
|
101
|
-
|
|
102
|
-
if (!process.env.DEV) {
|
|
103
|
-
plugins.push(terser({
|
|
104
|
-
numWorkers: 1,
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const es6DevMain = process.env.DEV && packageName === "@ui5/webcomponents";
|
|
109
|
-
if (es6DevMain && os.platform() !== "win32") {
|
|
110
|
-
plugins.push(livereload({
|
|
111
|
-
watch: [
|
|
112
|
-
"dist/resources/bundle.esm.js",
|
|
113
|
-
"dist/**/*.html",
|
|
114
|
-
"dist/**/*.json",
|
|
115
|
-
],
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (process.env.DEV) {
|
|
120
|
-
plugins.push(ui5DevReadyMessagePlugin());
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return plugins;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const getES6Config = (input = "bundle.esm.js") => {
|
|
127
|
-
return [{
|
|
128
|
-
input,
|
|
129
|
-
output: {
|
|
130
|
-
dir: "dist/resources",
|
|
131
|
-
format: "esm",
|
|
132
|
-
sourcemap: true,
|
|
133
|
-
},
|
|
134
|
-
watch: {
|
|
135
|
-
clearScreen: false,
|
|
136
|
-
},
|
|
137
|
-
plugins: getPlugins(),
|
|
138
|
-
onwarn: onwarn,
|
|
139
|
-
}];
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
let config = getES6Config();
|
|
143
|
-
|
|
144
|
-
if (process.env.SCOPE) {
|
|
145
|
-
if (fs.existsSync("bundle.scoped.esm.js")) {
|
|
146
|
-
config = config.concat(getES6Config("bundle.scoped.esm.js"));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
module.exports = config;
|