@ui5/webcomponents-tools 0.0.0-deac3098a → 0.0.0-df5b4199a

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 (142) hide show
  1. package/CHANGELOG.md +2155 -0
  2. package/LICENSE.txt +201 -0
  3. package/README.md +7 -10
  4. package/assets-meta.js +12 -11
  5. package/bin/dev.js +3 -6
  6. package/bin/ui5nps.js +265 -0
  7. package/components-package/eslint.js +66 -2
  8. package/components-package/nps.js +140 -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 +107 -0
  15. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  16. package/lib/cem/cem.js +12 -0
  17. package/lib/cem/custom-elements-manifest.config.mjs +546 -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 +423 -0
  78. package/lib/cem/validate.js +76 -0
  79. package/lib/chokidar/chokidar.js +29 -0
  80. package/lib/copy-and-watch/index.js +128 -97
  81. package/lib/copy-list/index.js +26 -20
  82. package/lib/create-icons/index.js +131 -72
  83. package/lib/create-illustrations/index.js +169 -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 +92 -0
  88. package/lib/css-processors/css-processor-themes.mjs +118 -0
  89. package/lib/css-processors/scope-variables.mjs +57 -0
  90. package/lib/css-processors/shared.mjs +46 -0
  91. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  92. package/lib/dev-server/dev-server.mjs +78 -0
  93. package/lib/dev-server/virtual-index-html-plugin.js +56 -0
  94. package/lib/eslint/eslint.js +42 -0
  95. package/lib/generate-js-imports/illustrations.js +85 -0
  96. package/lib/generate-json-imports/i18n.js +70 -70
  97. package/lib/generate-json-imports/themes.js +47 -49
  98. package/lib/hbs2lit/src/compiler.js +17 -6
  99. package/lib/hbs2lit/src/includesReplacer.js +5 -5
  100. package/lib/hbs2lit/src/litVisitor2.js +85 -22
  101. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  102. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
  103. package/lib/hbs2ui5/index.js +57 -24
  104. package/lib/i18n/defaults.js +74 -60
  105. package/lib/i18n/toJSON.js +22 -18
  106. package/lib/icons-hash/icons-hash.mjs +149 -0
  107. package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
  108. package/lib/remove-dev-mode/remove-dev-mode.mjs +51 -0
  109. package/lib/rimraf/rimraf.js +31 -0
  110. package/lib/scoping/get-all-tags.js +11 -11
  111. package/lib/scoping/lint-src.js +8 -7
  112. package/lib/scoping/scope-test-pages.js +2 -1
  113. package/lib/test-runner/test-runner.js +79 -0
  114. package/package.json +47 -44
  115. package/tsconfig.json +18 -0
  116. package/components-package/rollup-plugins/empty-module.js +0 -15
  117. package/components-package/rollup.js +0 -239
  118. package/components-package/wdio.sync.js +0 -360
  119. package/lib/documentation/index.js +0 -165
  120. package/lib/documentation/templates/api-component-since.js +0 -3
  121. package/lib/documentation/templates/api-css-variables-section.js +0 -24
  122. package/lib/documentation/templates/api-events-section.js +0 -35
  123. package/lib/documentation/templates/api-methods-section.js +0 -26
  124. package/lib/documentation/templates/api-properties-section.js +0 -42
  125. package/lib/documentation/templates/api-slots-section.js +0 -28
  126. package/lib/documentation/templates/template.js +0 -39
  127. package/lib/esm-abs-to-rel/index.js +0 -54
  128. package/lib/hash/config.js +0 -10
  129. package/lib/hash/generate.js +0 -19
  130. package/lib/hash/upToDate.js +0 -31
  131. package/lib/jsdoc/config.json +0 -29
  132. package/lib/jsdoc/plugin.js +0 -2436
  133. package/lib/jsdoc/template/publish.js +0 -4112
  134. package/lib/polyfill-placeholder/index.js +0 -5
  135. package/lib/postcss-css-to-esm/index.js +0 -45
  136. package/lib/postcss-css-to-json/index.js +0 -36
  137. package/lib/postcss-new-files/index.js +0 -36
  138. package/lib/postcss-p/postcss-p.mjs +0 -11
  139. package/lib/replace-global-core/index.js +0 -20
  140. package/lib/serve/index.js +0 -46
  141. package/lib/serve/serve.json +0 -3
  142. package/package-lock.json +0 -48
@@ -0,0 +1,51 @@
1
+ import { globby } from "globby";
2
+ import * as esbuild from 'esbuild'
3
+ import * as fs from "fs";
4
+ import { pathToFileURL } from "url";
5
+
6
+ const generate = async () => {
7
+ let customPlugin = {
8
+ name: 'ui5-tools',
9
+ setup(build) {
10
+ build.onLoad({ filter: /UI5Element.ts$/ }, async (args) => {
11
+ let text = await fs.promises.readFile(args.path, 'utf8');
12
+ text = text.replaceAll(/const DEV_MODE = true/g, "");
13
+ text = text.replaceAll(/if \(DEV_MODE\)/g, "if (false)");
14
+ return {
15
+ contents: text,
16
+ loader: 'ts',
17
+ }
18
+ })
19
+ },
20
+ }
21
+
22
+ const getConfig = async () => {
23
+ const config = {
24
+ entryPoints: await globby("src/**/*.ts"),
25
+ bundle: false,
26
+ minify: true,
27
+ sourcemap: true,
28
+ outdir: 'dist/prod',
29
+ outbase: 'src',
30
+ plugins: [
31
+ customPlugin,
32
+ ]
33
+ };
34
+ return config;
35
+ }
36
+
37
+
38
+ const config = await getConfig();
39
+ const result = await esbuild.build(config);
40
+ }
41
+
42
+ const filePath = process.argv[1];
43
+ const fileUrl = pathToFileURL(filePath).href;
44
+
45
+ if (import.meta.url === fileUrl) {
46
+ generate()
47
+ }
48
+
49
+ export default {
50
+ _ui5mainFn: generate
51
+ }
@@ -0,0 +1,31 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const rimraf = dir => {
5
+ if (fs.existsSync(dir)) {
6
+ fs.readdirSync(dir).forEach(entry => {
7
+ const entryPath = path.join(dir, entry);
8
+ if (fs.lstatSync(entryPath).isDirectory()) {
9
+ rimraf(entryPath);
10
+ } else {
11
+ fs.unlinkSync(entryPath);
12
+ }
13
+ });
14
+ fs.rmdirSync(dir);
15
+ }
16
+ };
17
+
18
+ const main = argv => {
19
+ if (argv.length < 3) {
20
+ console.error("rimraf <dir>");
21
+ process.exit(1);
22
+ }
23
+ const dir = argv[2];
24
+ rimraf(dir);
25
+ };
26
+
27
+ if (require.main === module) {
28
+ main(process.argv)
29
+ }
30
+
31
+ exports._ui5mainFn = main;
@@ -4,22 +4,22 @@ const glob = require("glob");
4
4
 
5
5
  const getTag = file => {
6
6
  const fileContent = String(fs.readFileSync(file)).replace(/\n/g, "");
7
- const matches = fileContent.match(/\btag\b:\s*\"(.*?)\"/);
8
- return matches ? matches[1] : undefined;
9
- };
10
-
11
- const getAltTag = file => {
12
- const fileContent = String(fs.readFileSync(file)).replace(/\n/g, "");
13
- const matches = fileContent.match(/\baltTag\b:\s*\"(.*?)\"/);
14
- return matches ? matches[1] : undefined;
7
+ let matches = fileContent.match(/\btag\b:\s*\"(.*?)\"/);
8
+ if (matches) {
9
+ return matches[1];
10
+ }
11
+ matches = fileContent.match(/@customElement\("(.*?)"\)/);
12
+ if (matches) {
13
+ return matches[1];
14
+ }
15
+ return undefined;
15
16
  };
16
17
 
17
18
  const getPackageTags = (packageDir) => {
18
19
  const srcDir = path.join(packageDir, "src/");
19
- return glob.sync(path.join(srcDir, "/**/*.js")).flatMap(file => {
20
+ return glob.sync(path.join(srcDir, "/**/*.ts")).flatMap(file => {
20
21
  const tag = getTag(file);
21
- const altTag = getAltTag(file);
22
- return [tag, altTag];
22
+ return [tag];
23
23
  }).filter(item => !!item);
24
24
  };
25
25
 
@@ -7,25 +7,26 @@ const tags = getAllTags(process.cwd());
7
7
 
8
8
  const errors = [];
9
9
 
10
+ const removeComments = str => str.replaceAll(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
11
+
10
12
  glob.sync(path.join(process.cwd(), "src/**/*.css")).forEach(file => {
11
- let content = String(fs.readFileSync(file));
13
+ let content = removeComments(String(fs.readFileSync(file)));
12
14
  tags.forEach(tag => {
13
15
  if (content.match(new RegExp(`(^|[^\.\-_A-Za-z0-9"\[])(${tag})([^\-_A-Za-z0-9]|$)`, "g"))) {
14
- errors.push(`Warning! ${tag} found in ${file}`);
16
+ errors.push(`${tag} found in ${file}`);
15
17
  }
16
18
  });
17
19
  });
18
20
 
19
- glob.sync(path.join(process.cwd(), "src/**/*.js")).forEach(file => {
20
- let content = String(fs.readFileSync(file));
21
+ glob.sync(path.join(process.cwd(), "src/**/*.ts")).forEach(file => {
22
+ let content = removeComments(String(fs.readFileSync(file)));
21
23
  tags.forEach(tag => {
22
24
  if (content.match(new RegExp(`querySelector[A-Za-z]*..${tag}`, "g"))) {
23
- errors.push(`Warning! querySelector for ${tag} found in ${file}`);
25
+ errors.push(`querySelector for ${tag} found in ${file}`);
24
26
  }
25
27
  });
26
28
  });
27
29
 
28
30
  if (errors.length) {
29
- errors.forEach(error => console.log(error));
30
- throw new Error("Errors found.");
31
+ throw new Error(`Scoping-related errors found (f.e. used ui5-input instead of [ui5-input]): \n ${errors.join("\n")}`);
31
32
  }
@@ -18,6 +18,7 @@ const replaceTagsHTML = content => {
18
18
 
19
19
  // Replace tags in any content
20
20
  const replaceTagsAny = content => {
21
+ console.log(tags.length);
21
22
  tags.forEach(tag => {
22
23
  content = content.replace(new RegExp(`(^|[^\-_A-Za-z0-9])(${tag})([^\-_A-Za-z0-9]|$)`, "g"), `$1$2-${suffix}$3`);
23
24
  });
@@ -27,7 +28,7 @@ const replaceTagsAny = content => {
27
28
  // Replace bundle names and HTML tag names in test pages
28
29
  glob.sync(path.join(root, "/**/*.html")).forEach(file => {
29
30
  let content = String(fs.readFileSync(file));
30
- content = content.replace(/bundle\.(.*?)\.js/g, `bundle.scoped.$1.js`);
31
+ content = content.replace("%VITE_BUNDLE_PATH%", "%VITE_BUNDLE_PATH_SCOPED%");
31
32
  content = replaceTagsHTML(content);
32
33
  fs.writeFileSync(file, content);
33
34
  });
@@ -0,0 +1,79 @@
1
+ const child_process = require("child_process");
2
+ const { readFileSync } = require("fs");
3
+ const path = require("path");
4
+ const fs = require("fs");
5
+
6
+ function testFn() {
7
+ // search for dev-server port
8
+ // start in current folder
9
+ // traversing upwards in case of mono repo tests and dev-server running in root folder of repository
10
+ let devServerFolder = process.cwd();
11
+ let devServerPort;
12
+ while (true) {
13
+ try {
14
+ devServerPort = readFileSync(path.join(devServerFolder, ".dev-server-port")).toString();
15
+ break; // found
16
+ } catch (e) {
17
+ // file not found
18
+ if (devServerFolder === path.dirname(devServerFolder)) {
19
+ break; // reached root folder "/"
20
+ }
21
+ devServerFolder = path.dirname(devServerFolder);
22
+ }
23
+ }
24
+
25
+ // check if we are in a monorepo and extract path from package.json
26
+ let packageRepositoryPath = "";
27
+ const pkg = require(path.join(process.cwd(), "package.json"));
28
+ packageRepositoryPath = pkg.repository ? pkg.repository.directory : "";
29
+
30
+ // construct base url
31
+ // use devServerPort if a dev server is running, otherwise let the baseUrl in the wdio config be used
32
+ // if a dev server is running in the root of a mono repo, append tha package path like this
33
+ // http://localhost:${devServerPort}/packages/main/
34
+ let baseUrl = "";
35
+ if (devServerPort) {
36
+ console.log(`Found port ${devServerPort} from '${path.join(devServerFolder, ".dev-server-port")}'`);
37
+ const devServerInRoot = !devServerFolder.includes(packageRepositoryPath);
38
+ if (devServerInRoot) {
39
+ baseUrl = `--base-url http://localhost:${devServerPort}/${packageRepositoryPath}/`;
40
+ } else {
41
+ baseUrl = `--base-url http://localhost:${devServerPort}/`;
42
+ }
43
+ }
44
+
45
+ if (!baseUrl) {
46
+ console.log("No dev server running, running tests served from `dist`, make sure it is up to date");
47
+ }
48
+
49
+ // add single spec parameter if passed
50
+ let spec = "";
51
+ if (process.argv.length === 3) {
52
+ const specFile = process.argv[2];
53
+ spec = `--spec ${specFile}`;
54
+ }
55
+
56
+ // more parameters - pass them to wdio
57
+ let restParams = "";
58
+ if (process.argv.length > 3) {
59
+ restParams = process.argv.slice(2).join(" ");
60
+ }
61
+
62
+ let wdioConfig = "";
63
+ if (fs.existsSync("config/wdio.conf.cjs")) {
64
+ wdioConfig = "config/wdio.conf.cjs";
65
+ } else if (fs.existsSync("config/wdio.conf.js")) {
66
+ wdioConfig = "config/wdio.conf.js";
67
+ }
68
+
69
+ // run wdio with calculated parameters
70
+ const cmd = `yarn cross-env WDIO_LOG_LEVEL=error wdio ${wdioConfig} ${spec} ${baseUrl} ${restParams}`;
71
+ console.log(`executing: ${cmd}`);
72
+ child_process.execSync(cmd, {stdio: 'inherit'});
73
+ }
74
+
75
+ if (require.main === module) {
76
+ testFn(process.argv)
77
+ }
78
+
79
+ exports._ui5mainFn = testFn;
package/package.json CHANGED
@@ -1,83 +1,86 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "0.0.0-deac3098a",
3
+ "version": "0.0.0-df5b4199a",
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",
78
- "zx": "^4.3.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"
79
68
  },
80
69
  "peerDependencies": {
81
- "chromedriver": "*"
82
- }
83
- }
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": "c07b41622cd8f0a2094b38233f6ad89f6cb4ee2b"
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;