@ui5/webcomponents-tools 0.0.0-7b7921cd9 → 0.0.0-7c7170d4a

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 (53) hide show
  1. package/CHANGELOG.md +854 -0
  2. package/README.md +2 -1
  3. package/assets-meta.js +15 -10
  4. package/components-package/eslint.js +2 -0
  5. package/components-package/nps.js +44 -43
  6. package/components-package/postcss.components.js +1 -21
  7. package/components-package/postcss.themes.js +1 -36
  8. package/components-package/wdio.js +414 -401
  9. package/icons-collection/nps.js +7 -5
  10. package/lib/amd-to-es6/index.js +102 -0
  11. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  12. package/lib/cem/custom-elements-manifest.config.mjs +501 -0
  13. package/lib/cem/event.mjs +131 -0
  14. package/lib/cem/schema-internal.json +1357 -0
  15. package/lib/cem/schema.json +1098 -0
  16. package/lib/cem/types-internal.d.ts +796 -0
  17. package/lib/cem/types.d.ts +736 -0
  18. package/lib/cem/utils.mjs +384 -0
  19. package/lib/cem/validate.js +70 -0
  20. package/lib/create-icons/index.js +8 -6
  21. package/lib/create-illustrations/index.js +51 -30
  22. package/lib/create-new-component/index.js +5 -12
  23. package/lib/create-new-component/tsFileContentTemplate.js +3 -12
  24. package/lib/css-processors/css-processor-component-styles.mjs +48 -0
  25. package/lib/css-processors/css-processor-components.mjs +77 -0
  26. package/lib/css-processors/css-processor-themes.mjs +79 -0
  27. package/lib/css-processors/scope-variables.mjs +49 -0
  28. package/lib/{postcss-css-to-esm/index.js → css-processors/shared.mjs} +36 -50
  29. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  30. package/lib/dev-server/ssr-dom-shim-loader.js +26 -0
  31. package/lib/generate-js-imports/illustrations.js +78 -64
  32. package/lib/generate-json-imports/i18n.js +10 -37
  33. package/lib/generate-json-imports/themes.js +9 -31
  34. package/lib/i18n/defaults.js +1 -1
  35. package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
  36. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  37. package/lib/scoping/get-all-tags.js +1 -1
  38. package/lib/scoping/lint-src.js +8 -7
  39. package/lib/scoping/scope-test-pages.js +2 -1
  40. package/package.json +11 -11
  41. package/components-package/wdio.sync.js +0 -368
  42. package/lib/create-new-component/jsFileContentTemplate.js +0 -73
  43. package/lib/esm-abs-to-rel/index.js +0 -58
  44. package/lib/generate-custom-elements-manifest/index.js +0 -327
  45. package/lib/jsdoc/config.json +0 -29
  46. package/lib/jsdoc/configTypescript.json +0 -29
  47. package/lib/jsdoc/plugin.js +0 -2468
  48. package/lib/jsdoc/preprocess.js +0 -146
  49. package/lib/jsdoc/template/publish.js +0 -4120
  50. package/lib/postcss-css-to-json/index.js +0 -47
  51. package/lib/postcss-new-files/index.js +0 -36
  52. package/lib/postcss-p/postcss-p.mjs +0 -14
  53. package/lib/replace-global-core/index.js +0 -25
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
2
2
 
3
+
3
4
  # UI5 Web Components - Tools
4
5
 
5
6
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)
@@ -13,7 +14,7 @@ used by other UI5 Web Components packages, such as `main` and `fiori`.
13
14
  - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
14
15
 
15
16
  ## Support
16
- We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://join-ui5-slack.herokuapp.com/).
17
+ We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://ui5-slack-invite.cfapps.eu10.hana.ondemand.com/).
17
18
 
18
19
  ## Contribute
19
20
  Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
package/assets-meta.js CHANGED
@@ -1,20 +1,20 @@
1
1
  const assetsMeta = {
2
2
  "themes": {
3
- "default": "sap_fiori_3",
3
+ "default": "sap_horizon",
4
4
  "all": [
5
5
  "sap_fiori_3",
6
6
  "sap_fiori_3_dark",
7
- "sap_belize",
8
- "sap_belize_hcb",
9
- "sap_belize_hcw",
10
7
  "sap_fiori_3_hcb",
11
8
  "sap_fiori_3_hcw",
12
- "sap_horizon",
13
- "sap_horizon_dark",
14
- "sap_horizon_hcb",
15
- "sap_horizon_hcw",
16
- "sap_horizon_exp"
17
- ]
9
+ "sap_horizon",
10
+ "sap_horizon_dark",
11
+ "sap_horizon_hcb",
12
+ "sap_horizon_hcw",
13
+ "sap_horizon_exp",
14
+ "sap_horizon_dark_exp",
15
+ "sap_horizon_hcb_exp",
16
+ "sap_horizon_hcw_exp",
17
+ ],
18
18
  },
19
19
  "languages": {
20
20
  "default": "en",
@@ -22,6 +22,7 @@ const assetsMeta = {
22
22
  "ar",
23
23
  "bg",
24
24
  "ca",
25
+ "cnr",
25
26
  "cs",
26
27
  "cy",
27
28
  "da",
@@ -49,6 +50,7 @@ const assetsMeta = {
49
50
  "ko",
50
51
  "lt",
51
52
  "lv",
53
+ "mk",
52
54
  "ms",
53
55
  "nl",
54
56
  "no",
@@ -60,6 +62,7 @@ const assetsMeta = {
60
62
  "sh",
61
63
  "sk",
62
64
  "sl",
65
+ "sr",
63
66
  "sv",
64
67
  "th",
65
68
  "tr",
@@ -77,6 +80,7 @@ const assetsMeta = {
77
80
  "ar_SA",
78
81
  "bg",
79
82
  "ca",
83
+ "cnr",
80
84
  "cs",
81
85
  "da",
82
86
  "de",
@@ -124,6 +128,7 @@ const assetsMeta = {
124
128
  "lt",
125
129
  "lv",
126
130
  "ms",
131
+ "mk",
127
132
  "nb",
128
133
  "nl",
129
134
  "nl_BE",
@@ -15,6 +15,7 @@ const overrides = tsMode ? [{
15
15
  ],
16
16
  parserOptions: {
17
17
  "project": ["./tsconfig.json", "./packages/*/tsconfig.json"],
18
+ EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
18
19
  },
19
20
  rules: {
20
21
  "no-shadow": "off",
@@ -27,6 +28,7 @@ const overrides = tsMode ? [{
27
28
  "@typescript-eslint/no-unsafe-call": "off",
28
29
  "@typescript-eslint/no-non-null-assertion": "off",
29
30
  "@typescript-eslint/no-empty-function": "off",
31
+ "@typescript-eslint/no-empty-interface": "off",
30
32
  "lines-between-class-members": "off",
31
33
  }
32
34
  }] : [];
@@ -1,24 +1,25 @@
1
1
  const path = require("path");
2
2
  const fs = require("fs");
3
- const resolve = require("resolve");
4
3
  const LIB = path.join(__dirname, `../lib/`);
5
- const preprocessJSDocScript = resolve.sync("@ui5/webcomponents-tools/lib/jsdoc/preprocess.js");
6
4
 
7
5
  const getScripts = (options) => {
8
6
 
9
7
  // The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
10
8
  const illustrationsData = options.illustrationsData || [];
11
- const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
9
+ const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
12
10
  const createIllustrationsJSImportsScript = illustrations.join(" && ");
13
11
 
14
- // The script creates the "dist/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
15
- const illustrationDestinationPaths = illustrationsData.map(illustrations => illustrations.destinationPath);
16
- const createIllustrationsLoadersScript = options.fioriPackage ? `node ${LIB}/generate-js-imports/illustrations.js ${illustrationDestinationPaths[0]} ${illustrationDestinationPaths[1]} dist/generated/js-imports` : "";
17
- const tsOption = options.typescript;
18
- const tsCommand = tsOption ? "tsc" : "";
19
- const tsWatchCommand = tsOption ? "tsc --watch" : "";
12
+ // The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
13
+ const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.set} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.filterOut.join(" ")}`).join(" && ");
14
+
15
+ const tsOption = !options.legacy;
16
+ const tsCommandOld = tsOption ? "tsc" : "";
17
+ let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
18
+ // this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
19
+ if (options.noWatchTS) {
20
+ tsWatchCommandStandalone = "";
21
+ }
20
22
  const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
21
- const copySrcGenerated = tsOption ? "" : "copy.srcGenerated";
22
23
 
23
24
  if (tsOption) {
24
25
  try {
@@ -51,22 +52,28 @@ const getScripts = (options) => {
51
52
  }
52
53
 
53
54
  const scripts = {
54
- clean: 'rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
55
+ clean: 'rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
55
56
  lint: `eslint . ${eslintConfig}`,
56
57
  lintfix: `eslint . ${eslintConfig} --fix`,
57
- prepare: {
58
- default: `${tsCrossEnv} nps clean prepare.all typescript generateAPI`,
58
+ generate: {
59
+ default: `${tsCrossEnv} nps prepare.all`,
59
60
  all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
60
61
  styleRelated: "nps build.styles build.jsonImports build.jsImports",
61
62
  },
62
- typescript: tsCommand,
63
+ prepare: {
64
+ default: `${tsCrossEnv} nps clean prepare.all copy prepare.typescript generateAPI`,
65
+ all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
66
+ styleRelated: "nps build.styles build.jsonImports build.jsImports",
67
+ typescript: tsCommandOld,
68
+ },
63
69
  build: {
64
- default: "nps prepare lint build.bundle",
65
- templates: `mkdirp dist/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
70
+ default: "nps prepare lint build.bundle", // build.bundle2
71
+ templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
66
72
  styles: {
67
- default: `nps build.styles.themes build.styles.components ${copySrcGenerated}`,
68
- themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
69
- components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
73
+ default: `concurrently "nps build.styles.themes" "nps build.styles.components" "nps build.styles.componentStyles"`,
74
+ themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
75
+ components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
76
+ componentStyles: `node "${LIB}/css-processors/css-processor-component-styles.mjs"`,
70
77
  },
71
78
  i18n: {
72
79
  default: "nps build.i18n.defaultsjs build.i18n.json",
@@ -74,41 +81,38 @@ const getScripts = (options) => {
74
81
  json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
75
82
  },
76
83
  jsonImports: {
77
- default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
78
- themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes dist/generated/json-imports`,
79
- i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
84
+ default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
85
+ themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes src/generated/json-imports`,
86
+ i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n src/generated/json-imports`,
80
87
  },
81
88
  jsImports: {
82
- default: "mkdirp dist/generated/js-imports && nps build.jsImports.illustrationsLoaders",
89
+ default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
83
90
  illustrationsLoaders: createIllustrationsLoadersScript,
84
91
  },
85
- bundle: `vite build ${viteConfig}`,
92
+ bundle: `vite build ${viteConfig} --mode testing`,
93
+ bundle2: ``,
86
94
  illustrations: createIllustrationsJSImportsScript,
87
95
  },
88
96
  copy: {
89
97
  default: "nps copy.src copy.props",
90
- src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
91
- srcGenerated: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.js" dist/generated/`,
98
+ src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
99
+ // srcGenerated2: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.{js,json}" dist/generated/`,
92
100
  props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
93
101
  },
94
102
  watch: {
95
- default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.typescript" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
103
+ default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" "nps watch.src" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
96
104
  devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
97
105
  src: 'nps "copy.src --watch --safe --skip-initial-copy"',
98
- typescript: tsWatchCommand,
106
+ typescript: tsWatchCommandStandalone,
99
107
  props: 'nps "copy.props --watch --safe --skip-initial-copy"',
100
108
  bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
101
109
  styles: {
102
- default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
110
+ default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components" "nps watch.styles.componentStyles" ',
103
111
  themes: 'nps "build.styles.themes -w"',
104
- components: {
105
- default: 'concurrently "nps watch.styles.components.existingFiles" "nps watch.styles.components.newFiles"',
106
- existingFiles: `nps "build.styles.components -w"`,
107
- newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
108
- },
112
+ components: `nps "build.styles.components -w"`,
113
+ componentStyles: `nps "build.styles.componentStyles -w"`,
109
114
  },
110
115
  templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
111
- api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
112
116
  i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
113
117
  },
114
118
  start: "nps prepare watch.devServer",
@@ -117,7 +121,7 @@ const getScripts = (options) => {
117
121
  "test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
118
122
  startWithScope: "nps scope.prepare scope.watchWithBundle",
119
123
  scope: {
120
- prepare: "nps scope.lint prepare scope.testPages",
124
+ prepare: "nps scope.lint scope.testPages",
121
125
  lint: `node "${LIB}/scoping/lint-src.js"`,
122
126
  testPages: {
123
127
  default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
@@ -126,16 +130,13 @@ const getScripts = (options) => {
126
130
  replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
127
131
  },
128
132
  watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
129
- watch: 'concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.props" "nps watch.styles"',
133
+ watch: 'concurrently "nps watch.templates" "nps watch.src" "nps watch.props" "nps watch.styles"',
130
134
  bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
131
135
  },
132
136
  generateAPI: {
133
- default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest",
134
- prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
135
- prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
136
- preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
137
- jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
138
- cleanup: "rimraf jsdoc-dist/"
137
+ default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
138
+ generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.dev ? "--dev" : "" }`,
139
+ validateCEM: `node "${LIB}/cem/validate.js" ${ options.dev ? "--dev" : "" }`,
139
140
  },
140
141
  };
141
142
 
@@ -1,21 +1 @@
1
- const postcssImport = require('postcss-import');
2
- const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
3
- const cssnano = require('cssnano');
4
- const fs = require("fs");
5
-
6
- const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
7
-
8
- module.exports = {
9
- plugins: [
10
- postcssImport(),
11
- cssnano({
12
- preset: [
13
- 'default', {
14
- mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
15
- mergeRules: false, // https://github.com/cssnano/cssnano/issues/730
16
- },
17
- ]
18
- }),
19
- postcssCSStoESM({ toReplace: 'src', includeDefaultTheme: true, packageName }),
20
- ]
21
- }
1
+ module.exports = {}
@@ -1,36 +1 @@
1
- const postcssImport = require('postcss-import');
2
- const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
3
- const postcssCSStoJSON = require('../lib/postcss-css-to-json/index.js');
4
- const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
5
- const cssnano = require('cssnano');
6
- const modifySelectors = require("modify-selectors");
7
- const fs = require("fs");
8
-
9
- const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
10
-
11
- module.exports = {
12
- plugins: [
13
- postcssImport(),
14
- combineSelectors({
15
- removeDuplicatedProperties: true
16
- }),
17
- cssnano({
18
- preset: [
19
- 'default', {
20
- mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
21
- },
22
- ]
23
- },),
24
- modifySelectors({
25
- enable: true,
26
- suffix: [
27
- {
28
- match: '*',
29
- with: '[_ui5host]', // Add suffix to each selector in the file (:root => :root [_ui5host])
30
- },
31
- ],
32
- }),
33
- postcssCSStoJSON({ toReplace: 'src', packageName }),
34
- postcssCSStoESM({ toReplace: 'src', packageName }),
35
- ]
36
- };
1
+ module.exports = {};