@ui5/webcomponents-tools 0.0.0-a3eca7ade → 0.0.0-a8a75c830

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.
Files changed (143) hide show
  1. package/CHANGELOG.md +2343 -0
  2. package/LICENSE.txt +201 -0
  3. package/README.md +7 -10
  4. package/assets-meta.js +13 -8
  5. package/bin/dev.js +10 -8
  6. package/bin/ui5nps.js +301 -0
  7. package/components-package/eslint.js +66 -2
  8. package/components-package/nps.js +141 -80
  9. package/components-package/postcss.components.js +1 -21
  10. package/components-package/postcss.themes.js +1 -26
  11. package/components-package/vite.config.js +9 -0
  12. package/components-package/wdio.js +69 -17
  13. package/icons-collection/nps.js +32 -24
  14. package/lib/amd-to-es6/index.js +109 -0
  15. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  16. package/lib/cem/cem.js +16 -0
  17. package/lib/cem/custom-elements-manifest.config.mjs +575 -0
  18. package/lib/cem/event.mjs +168 -0
  19. package/lib/cem/patch/@custom-elements-manifest/analyzer/cli.js +128 -0
  20. package/lib/cem/patch/@custom-elements-manifest/analyzer/package.json +59 -0
  21. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/browser-entrypoint.js +23 -0
  22. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/create.js +117 -0
  23. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/arrow-function.js +26 -0
  24. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/class-jsdoc.js +157 -0
  25. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/classes.js +20 -0
  26. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createArrowFunction.js +17 -0
  27. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createAttribute.js +24 -0
  28. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createClass.js +301 -0
  29. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createClassField.js +26 -0
  30. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createFunctionLike.js +73 -0
  31. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createMixin.js +33 -0
  32. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createVariable.js +22 -0
  33. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/handlers.js +338 -0
  34. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/custom-elements-define-calls.js +90 -0
  35. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/exports.js +156 -0
  36. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/function-like.js +24 -0
  37. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/mixins.js +29 -0
  38. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/reexported-wrapped-mixin-exports.js +84 -0
  39. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/variables.js +34 -0
  40. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/collect-phase/collect-imports.js +101 -0
  41. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst/catalyst.js +11 -0
  42. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst/controller.js +34 -0
  43. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst-major-2/catalyst.js +11 -0
  44. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst-major-2/controller.js +34 -0
  45. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/decorators/attr.js +53 -0
  46. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/decorators/custom-element-decorator.js +36 -0
  47. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/fast/fast.js +7 -0
  48. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/lit.js +13 -0
  49. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/member-denylist.js +21 -0
  50. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/method-denylist.js +20 -0
  51. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/property-decorator.js +94 -0
  52. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/static-properties.js +121 -0
  53. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/utils.js +66 -0
  54. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/stencil/stencil.js +129 -0
  55. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/index.js +80 -0
  56. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/cleanup-classes.js +25 -0
  57. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/field-denylist.js +22 -0
  58. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/method-denylist.js +25 -0
  59. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/apply-inheritance.js +78 -0
  60. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/is-custom-element.js +34 -0
  61. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/link-class-to-tagname.js +27 -0
  62. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/remove-unexported-declarations.js +23 -0
  63. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/resolve-initializers.js +52 -0
  64. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/ast-helpers.js +186 -0
  65. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/cli-helpers.js +164 -0
  66. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/exports.js +44 -0
  67. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/find-external-manifests.js +67 -0
  68. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/imports.js +25 -0
  69. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/index.js +71 -0
  70. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/jsdoc.js +19 -0
  71. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/manifest-helpers.js +194 -0
  72. package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/mixins.js +112 -0
  73. package/lib/cem/schema-internal.json +1422 -0
  74. package/lib/cem/schema.json +1098 -0
  75. package/lib/cem/types-internal.d.ts +808 -0
  76. package/lib/cem/types.d.ts +736 -0
  77. package/lib/cem/utils.mjs +429 -0
  78. package/lib/cem/validate.js +81 -0
  79. package/lib/chokidar/chokidar.js +28 -0
  80. package/lib/copy-and-watch/index.js +133 -97
  81. package/lib/copy-list/index.js +27 -19
  82. package/lib/create-icons/index.js +131 -72
  83. package/lib/create-illustrations/index.js +174 -114
  84. package/lib/create-new-component/Component.js +74 -0
  85. package/lib/create-new-component/ComponentTemplate.js +12 -0
  86. package/lib/create-new-component/index.js +62 -101
  87. package/lib/css-processors/css-processor-components.mjs +103 -0
  88. package/lib/css-processors/css-processor-themes.mjs +122 -0
  89. package/lib/css-processors/postcss-plugin.mjs +153 -0
  90. package/lib/css-processors/scope-variables.mjs +74 -0
  91. package/lib/css-processors/shared.mjs +47 -0
  92. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  93. package/lib/dev-server/dev-server.mjs +78 -0
  94. package/lib/dev-server/virtual-index-html-plugin.js +56 -0
  95. package/lib/eslint/eslint.js +44 -0
  96. package/lib/generate-js-imports/illustrations.js +87 -0
  97. package/lib/generate-json-imports/i18n.js +71 -69
  98. package/lib/generate-json-imports/themes.js +50 -48
  99. package/lib/hbs2lit/src/compiler.js +24 -4
  100. package/lib/hbs2lit/src/includesReplacer.js +5 -5
  101. package/lib/hbs2lit/src/litVisitor2.js +85 -22
  102. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  103. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
  104. package/lib/hbs2ui5/index.js +57 -24
  105. package/lib/i18n/defaults.js +76 -60
  106. package/lib/i18n/toJSON.js +47 -18
  107. package/lib/icons-hash/icons-hash.mjs +149 -0
  108. package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
  109. package/lib/remove-dev-mode/remove-dev-mode.mjs +51 -0
  110. package/lib/rimraf/rimraf.js +31 -0
  111. package/lib/scoping/get-all-tags.js +11 -11
  112. package/lib/scoping/lint-src.js +8 -7
  113. package/lib/scoping/scope-test-pages.js +2 -1
  114. package/lib/test-runner/test-runner.js +79 -0
  115. package/lib/vite-bundler/vite-bundler.mjs +35 -0
  116. package/package.json +47 -43
  117. package/tsconfig.json +18 -0
  118. package/components-package/rollup-plugins/empty-module.js +0 -15
  119. package/components-package/rollup.js +0 -239
  120. package/components-package/wdio.sync.js +0 -360
  121. package/lib/documentation/index.js +0 -165
  122. package/lib/documentation/templates/api-component-since.js +0 -3
  123. package/lib/documentation/templates/api-css-variables-section.js +0 -24
  124. package/lib/documentation/templates/api-events-section.js +0 -35
  125. package/lib/documentation/templates/api-methods-section.js +0 -26
  126. package/lib/documentation/templates/api-properties-section.js +0 -42
  127. package/lib/documentation/templates/api-slots-section.js +0 -28
  128. package/lib/documentation/templates/template.js +0 -39
  129. package/lib/esm-abs-to-rel/index.js +0 -54
  130. package/lib/hash/config.js +0 -10
  131. package/lib/hash/generate.js +0 -19
  132. package/lib/hash/upToDate.js +0 -31
  133. package/lib/jsdoc/config.json +0 -29
  134. package/lib/jsdoc/plugin.js +0 -2436
  135. package/lib/jsdoc/template/publish.js +0 -4112
  136. package/lib/polyfill-placeholder/index.js +0 -5
  137. package/lib/postcss-css-to-esm/index.js +0 -45
  138. package/lib/postcss-css-to-json/index.js +0 -36
  139. package/lib/postcss-new-files/index.js +0 -36
  140. package/lib/replace-global-core/index.js +0 -20
  141. package/lib/serve/index.js +0 -46
  142. package/lib/serve/serve.json +0 -3
  143. package/package-lock.json +0 -48
package/package.json CHANGED
@@ -1,82 +1,86 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "0.0.0-a3eca7ade",
3
+ "version": "0.0.0-a8a75c830",
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
- "wc-dev": "bin/dev.js",
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/SAP/ui5-webcomponents.git",
19
+ "url": "https://github.com/UI5/webcomponents.git",
21
20
  "directory": "packages/tools"
22
21
  },
23
22
  "dependencies": {
24
- "@babel/core": "^7.13.10",
25
- "@babel/preset-env": "^7.13.10",
26
- "@openui5/sap.ui.core": "1.95.0",
27
- "@rollup/plugin-babel": "^5.3.0",
28
- "@rollup/plugin-commonjs": "^21.0.1",
29
- "@rollup/plugin-json": "^4.1.0",
30
- "@rollup/plugin-node-resolve": "^13.0.5",
31
- "@rollup/plugin-replace": "^3.0.0",
32
- "@rollup/plugin-url": "^6.0.0",
33
- "@wdio/cli": "^7.12.2",
34
- "@wdio/dot-reporter": "^7.10.1",
35
- "@wdio/local-runner": "^7.12.2",
36
- "@wdio/mocha-framework": "^7.12.2",
37
- "@wdio/spec-reporter": "^7.10.1",
38
- "@webcomponents/webcomponentsjs": "^2.5.0",
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",
39
34
  "chai": "^4.3.4",
40
35
  "child_process": "^1.0.2",
41
- "chokidar": "^3.5.1",
42
- "chokidar-cli": "^3.0.0",
43
- "cli-color": "^2.0.1",
36
+ "chokidar": "^3.6.0",
44
37
  "command-line-args": "^5.1.1",
45
- "concurrently": "^6.0.0",
38
+ "comment-parser": "^1.4.0",
46
39
  "cross-env": "^7.0.3",
47
- "cssnano": "^4.1.11",
40
+ "custom-element-jet-brains-integration": "^1.4.4",
41
+ "dotenv": "^16.5.0",
48
42
  "escodegen": "^2.0.0",
49
43
  "eslint": "^7.22.0",
50
44
  "eslint-config-airbnb-base": "^14.2.1",
51
- "eslint-plugin-import": "^2.22.1",
45
+ "eslint-plugin-import": "^2.31.0",
46
+ "eslint-plugin-jsx-no-leaked-values": "^0.1.24",
52
47
  "esprima": "^4.0.1",
53
- "folder-hash": "^4.0.1",
54
48
  "getopts": "^2.3.0",
55
49
  "glob": "^7.1.6",
56
50
  "glob-parent": "^6.0.2",
51
+ "globby": "^13.1.1",
57
52
  "handlebars": "^4.7.7",
53
+ "ignore": "^7.0.5",
58
54
  "is-port-reachable": "^3.1.0",
59
- "jsdoc": "^3.6.6",
60
55
  "json-beautify": "^1.1.1",
61
- "mkdirp": "^1.0.4",
62
- "nps": "^5.10.0",
63
56
  "postcss": "^8.4.5",
64
57
  "postcss-cli": "^9.1.0",
65
- "postcss-combine-duplicated-selectors": "^10.0.3",
66
- "postcss-import": "^14.0.2",
58
+ "postcss-selector-parser": "^6.0.10",
59
+ "prompts": "^2.4.2",
67
60
  "properties-reader": "^2.2.0",
68
61
  "recursive-readdir": "^2.2.2",
69
62
  "resolve": "^1.20.0",
70
- "rimraf": "^3.0.2",
71
- "rollup": "^2.41.4",
72
- "rollup-plugin-filesize": "^9.1.1",
73
- "rollup-plugin-livereload": "^2.0.0",
74
- "rollup-plugin-terser": "^7.0.2",
75
- "serve": "^12.0.0",
76
63
  "slash": "3.0.0",
77
- "wdio-chromedriver-service": "^7.0.0"
64
+ "string-argv": "^0.3.2",
65
+ "vite": "^5.4.8",
66
+ "vite-plugin-istanbul": "^6.0.2",
67
+ "wdio-chromedriver-service": "^7.3.2"
78
68
  },
79
69
  "peerDependencies": {
80
- "chromedriver": "*"
81
- }
82
- }
70
+ "chromedriver": "*",
71
+ "typescript": "^5.6.2"
72
+ },
73
+ "peerDependenciesMeta": {
74
+ "typescript": {
75
+ "optional": true
76
+ }
77
+ },
78
+ "engines": {
79
+ "node": "^20.19.0 || >=22.12.0"
80
+ },
81
+ "devDependencies": {
82
+ "esbuild": "^0.25.0",
83
+ "yargs": "^17.5.1"
84
+ },
85
+ "gitHead": "b606663e2feb753ddf5fc58c3b90dc15fb490364"
86
+ }
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,239 +0,0 @@
1
- const process = require("process");
2
- const fs = require("fs");
3
- const os = require("os");
4
- const { babel } = require("@rollup/plugin-babel");
5
- const { nodeResolve } = require("@rollup/plugin-node-resolve");
6
- const url = require("@rollup/plugin-url");
7
- const { terser } = require("rollup-plugin-terser");
8
- const json = require("@rollup/plugin-json");
9
- const replace = require("@rollup/plugin-replace");
10
- const commonjs = require("@rollup/plugin-commonjs");
11
- const colors = require("cli-color");
12
- const filesize = require("rollup-plugin-filesize");
13
- const livereload = require("rollup-plugin-livereload");
14
- const emptyModulePlugin = require("./rollup-plugins/empty-module.js");
15
-
16
- const packageFile = JSON.parse(fs.readFileSync("./package.json"));
17
- const packageName = packageFile.name;
18
- const DEPLOY_PUBLIC_PATH = process.env.DEPLOY_PUBLIC_PATH || "";
19
-
20
- const warningsToSkip = [{
21
- warningCode: "THIS_IS_UNDEFINED",
22
- filePath: /.+zxing.+/,
23
- }];
24
-
25
- function ui5DevImportCheckerPlugin() {
26
- return {
27
- name: "ui5-dev-import-checker-plugin",
28
- transform(code, file) {
29
- const re = new RegExp(`^import.*"${packageName}/`);
30
- if (re.test(code)) {
31
- throw new Error(`illegal import in ${file}`);
32
- }
33
- },
34
- };
35
- }
36
-
37
- function onwarn(warning, warn) {
38
- // Skip warning for known false positives that will otherwise polute the log
39
- let skip = warningsToSkip.find(warningToSkip => {
40
- let loc, file;
41
- return warning.code === warningToSkip.warningCode
42
- && (loc = warning.loc)
43
- && (file = loc.file)
44
- && file.match(warningToSkip.filePath);
45
- });
46
- if (skip) {
47
- return;
48
- }
49
-
50
- // warn everything else
51
- warn( warning );
52
- }
53
-
54
- const reportedForPackages = new Set(); // sometimes writeBundle is called more than once per bundle -> suppress extra messages
55
- function ui5DevReadyMessagePlugin() {
56
- return {
57
- name: "ui5-dev-message-ready-plugin",
58
- writeBundle: (assets, bundle) => {
59
- if (reportedForPackages.has(packageName)) {
60
- return;
61
- }
62
- console.log(colors.blue(`${colors.bold(packageName)} successfully built!`));
63
-
64
- if (fs.existsSync(".port")) {
65
- const port = `${fs.readFileSync(".port")}`;
66
- if (port) {
67
- console.log(colors.blue(`Navigate to: ${colors.bold(`http://localhost:${port}/test-resources/pages/`)}`));
68
- }
69
- }
70
- reportedForPackages.add(packageName);
71
- },
72
- };
73
- }
74
-
75
- const getPlugins = ({ transpile }) => {
76
- const plugins = [];
77
-
78
- if (process.env.DEV) {
79
- plugins.push(replace({
80
- values: {
81
- 'const DEV_MODE = false': 'const DEV_MODE = true',
82
- },
83
- preventAssignment: false,
84
- }));
85
- }
86
-
87
- if (process.env.DEV && !process.env.ENABLE_CLDR) {
88
- // Empty the CLDR assets file for better performance during development
89
- plugins.push(emptyModulePlugin({
90
- emptyModules: [
91
- "localization/dist/Assets.js",
92
- ],
93
- }));
94
- }
95
-
96
- if (!process.env.DEV) {
97
- plugins.push(filesize(
98
- {
99
- reporter(options, bundle, {
100
- minSize, gzipSize, brotliSize, bundleSize,
101
- fileName,
102
- // "showBeforeSizes: release"
103
- lastVersion,
104
- // "showBeforeSizes: "release" or "showBeforeSizes": "build"
105
- bundleSizeBefore, brotliSizeBefore, minSizeBefore, gzipSizeBefore,
106
- }) {
107
- // If a promise is returned, it will be awaited before rendering.
108
- return `${fileName.padEnd(35)} ${minSize} / gzipped: ${gzipSize}`;
109
- },
110
- },
111
-
112
- ));
113
- }
114
-
115
- const publicPath = DEPLOY_PUBLIC_PATH;
116
-
117
- plugins.push(ui5DevImportCheckerPlugin());
118
-
119
- if (!transpile) {
120
- plugins.push(json({
121
- include: [
122
- /.*assets\/.*\.json/,
123
- ],
124
- namedExports: false,
125
- }));
126
- }
127
-
128
- if (transpile) {
129
- plugins.push(url({
130
- limit: 0,
131
- include: [
132
- /.*assets\/.*\.json/,
133
- ],
134
- emitFiles: true,
135
- fileName: "[name].[hash][extname]",
136
- publicPath,
137
- }));
138
- }
139
-
140
- if (transpile) {
141
- plugins.push(commonjs());
142
- plugins.push(babel({
143
- presets: ["@babel/preset-env"],
144
- exclude: /node_modules\/(?!(lit-html|@ui5\/webcomponents))/, // exclude all node_modules/ except lit-html and all starting with @ui5/webcomponents
145
- sourcemap: false,
146
- babelHelpers: "bundled",
147
- }));
148
- }
149
-
150
- plugins.push(nodeResolve());
151
-
152
- if (!process.env.DEV) {
153
- plugins.push(terser({
154
- numWorkers: 1,
155
- }));
156
- }
157
-
158
- const es6DevMain = process.env.DEV && !transpile && packageName === "@ui5/webcomponents";
159
- if (es6DevMain && os.platform() !== "win32") {
160
- plugins.push(livereload({
161
- watch: [
162
- "dist/resources/bundle.esm.js",
163
- "dist/**/*.html",
164
- "dist/**/*.json",
165
- ],
166
- }));
167
- }
168
-
169
- if (process.env.DEV) {
170
- plugins.push(ui5DevReadyMessagePlugin());
171
- }
172
-
173
- return plugins;
174
- };
175
-
176
- const getES6Config = (input = "bundle.esm.js") => {
177
- return [{
178
- input,
179
- output: {
180
- dir: "dist/resources",
181
- format: "esm",
182
- sourcemap: true,
183
- },
184
- moduleContext: id => {
185
- if (typeof id === "string" && id.includes("url-search-params-polyfill")) {
186
- // suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
187
- return "window";
188
- }
189
- },
190
- watch: {
191
- clearScreen: false,
192
- },
193
- plugins: getPlugins({ transpile: false }),
194
- onwarn: onwarn,
195
- }];
196
- };
197
-
198
- const getES5Config = (input = "bundle.es5.js") => {
199
- return [{
200
- input,
201
- output: {
202
- dir: "dist/resources",
203
- format: "iife",
204
- inlineDynamicImports: true,
205
- name: "sap-ui-webcomponents-bundle",
206
- extend: "true", // Whether or not to extend the global variable defined by the name option in umd or iife formats.
207
- sourcemap: true,
208
- },
209
- moduleContext: id => {
210
- if (id.includes("url-search-params-polyfill")) {
211
- // suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
212
- return "window";
213
- }
214
- },
215
- watch: {
216
- clearScreen: false,
217
- },
218
- plugins: getPlugins({ transpile: true }),
219
- onwarn: onwarn,
220
- }];
221
- };
222
-
223
- let config = getES6Config();
224
-
225
- if (process.env.ES5_BUILD && fs.existsSync("bundle.es5.js")) {
226
- config = config.concat(getES5Config());
227
- }
228
-
229
- if (process.env.SCOPE) {
230
- if (fs.existsSync("bundle.scoped.esm.js")) {
231
- config = config.concat(getES6Config("bundle.scoped.esm.js"));
232
-
233
- if (fs.existsSync("bundle.scoped.es5.js") && process.env.ES5_BUILD) {
234
- config = config.concat(getES5Config("bundle.scoped.es5.js"));
235
- }
236
- }
237
- }
238
-
239
- module.exports = config;