@ui5/webcomponents-tools 0.0.0-6ef02a35f → 0.0.0-701b14e36

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 (74) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/README.md +1 -1
  3. package/assets-meta.js +7 -1
  4. package/components-package/nps.js +17 -22
  5. package/components-package/postcss.themes.js +6 -3
  6. package/components-package/rollup-plugins/empty-module.js +15 -0
  7. package/components-package/rollup.js +25 -91
  8. package/components-package/wdio.js +50 -25
  9. package/components-package/wdio.sync.js +360 -0
  10. package/icons-collection/nps.js +41 -13
  11. package/lib/copy-and-watch/index.js +24 -0
  12. package/lib/copy-list/index.js +16 -16
  13. package/lib/create-icons/index.js +83 -58
  14. package/lib/create-illustrations/index.js +161 -0
  15. package/lib/create-new-component/index.js +12 -4
  16. package/lib/documentation/index.js +119 -116
  17. package/lib/documentation/templates/api-properties-section.js +3 -1
  18. package/lib/documentation/templates/template.js +2 -1
  19. package/lib/esm-abs-to-rel/index.js +13 -9
  20. package/lib/generate-json-imports/i18n.js +38 -31
  21. package/lib/generate-json-imports/themes.js +28 -21
  22. package/lib/hbs2lit/src/compiler.js +12 -3
  23. package/lib/hbs2lit/src/includesReplacer.js +5 -5
  24. package/lib/hbs2lit/src/litVisitor2.js +13 -5
  25. package/lib/hbs2lit/src/svgProcessor.js +3 -3
  26. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +4 -10
  27. package/lib/hbs2ui5/index.js +37 -21
  28. package/lib/i18n/defaults.js +49 -57
  29. package/lib/i18n/toJSON.js +12 -11
  30. package/lib/jsdoc/plugin.js +9 -0
  31. package/lib/jsdoc/template/publish.js +13 -2
  32. package/lib/postcss-combine-duplicated-selectors/index.js +178 -0
  33. package/lib/postcss-css-to-esm/index.js +4 -4
  34. package/lib/postcss-css-to-json/index.js +7 -2
  35. package/lib/postcss-p/postcss-p.mjs +11 -0
  36. package/lib/replace-global-core/index.js +13 -8
  37. package/lib/scoping/lint-src.js +1 -1
  38. package/lib/scoping/missing-dependencies.js +65 -0
  39. package/lib/scoping/report-tags-usage.js +28 -0
  40. package/lib/serve/index.js +1 -1
  41. package/package.json +23 -32
  42. package/bin/init-ui5-package.js +0 -3
  43. package/lib/hash/config.js +0 -10
  44. package/lib/hash/generate.js +0 -19
  45. package/lib/hash/upToDate.js +0 -31
  46. package/lib/init-package/index.js +0 -136
  47. package/lib/init-package/resources/.eslintignore +0 -3
  48. package/lib/init-package/resources/bundle.es5.js +0 -25
  49. package/lib/init-package/resources/bundle.esm.js +0 -31
  50. package/lib/init-package/resources/config/.eslintrc.js +0 -1
  51. package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
  52. package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
  53. package/lib/init-package/resources/config/rollup.config.js +0 -1
  54. package/lib/init-package/resources/config/wdio.conf.js +0 -1
  55. package/lib/init-package/resources/package-scripts.js +0 -11
  56. package/lib/init-package/resources/src/Assets.js +0 -5
  57. package/lib/init-package/resources/src/MyFirstComponent.hbs +0 -1
  58. package/lib/init-package/resources/src/MyFirstComponent.js +0 -56
  59. package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
  60. package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
  61. package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
  62. package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
  63. package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
  64. package/lib/init-package/resources/src/themes/MyFirstComponent.css +0 -11
  65. package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
  66. package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
  67. package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  68. package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  69. package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  70. package/lib/init-package/resources/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
  71. package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
  72. package/lib/init-package/resources/test/pages/index.html +0 -56
  73. package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
  74. package/lib/polyfill-placeholder/index.js +0 -5
package/CHANGELOG.md CHANGED
@@ -3,6 +3,132 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.3.1](https://github.com/SAP/ui5-webcomponents/compare/v1.3.0...v1.3.1) (2022-04-27)
7
+
8
+ **Note:** Version bump only for package @ui5/webcomponents-tools
9
+
10
+
11
+
12
+
13
+
14
+ # [1.3.0](https://github.com/SAP/ui5-webcomponents/compare/v1.2.4...v1.3.0) (2022-04-19)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **localization:** fix js error if "sh" locale set ([#4905](https://github.com/SAP/ui5-webcomponents/issues/4905)) ([979bca2](https://github.com/SAP/ui5-webcomponents/commit/979bca2)), closes [#4904](https://github.com/SAP/ui5-webcomponents/issues/4904)
20
+
21
+
22
+
23
+
24
+
25
+ ## [1.2.4](https://github.com/SAP/ui5-webcomponents/compare/v1.2.3...v1.2.4) (2022-03-30)
26
+
27
+ **Note:** Version bump only for package @ui5/webcomponents-tools
28
+
29
+
30
+
31
+
32
+
33
+ ## [1.2.3](https://github.com/SAP/ui5-webcomponents/compare/v1.2.2...v1.2.3) (2022-03-23)
34
+
35
+ **Note:** Version bump only for package @ui5/webcomponents-tools
36
+
37
+
38
+
39
+
40
+
41
+ ## [1.2.2](https://github.com/SAP/ui5-webcomponents/compare/v1.2.1...v1.2.2) (2022-03-22)
42
+
43
+
44
+ **Note:** Version bump only for package @ui5/webcomponents-tools
45
+
46
+
47
+
48
+
49
+
50
+ ## [1.2.1](https://github.com/SAP/ui5-webcomponents/compare/v1.2.0...v1.2.1) (2022-03-02)
51
+
52
+ **Note:** Version bump only for package @ui5/webcomponents-tools
53
+
54
+
55
+
56
+
57
+
58
+ # [1.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
59
+
60
+
61
+ ### Bug Fixes
62
+
63
+ * correct scoping issues with several components ([#4820](https://github.com/SAP/ui5-webcomponents/issues/4820)) ([621dc20](https://github.com/SAP/ui5-webcomponents/commit/621dc20))
64
+ * display methods in child components API ([#4792](https://github.com/SAP/ui5-webcomponents/issues/4792)) ([1929d08](https://github.com/SAP/ui5-webcomponents/commit/1929d08))
65
+
66
+
67
+ ### Features
68
+
69
+ * **jsdoc:** remove attr name for Object props ([#4680](https://github.com/SAP/ui5-webcomponents/issues/4680)) ([1741bd6](https://github.com/SAP/ui5-webcomponents/commit/1741bd6)), closes [#4674](https://github.com/SAP/ui5-webcomponents/issues/4674)
70
+
71
+
72
+
73
+
74
+
75
+ ## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
76
+
77
+ **Note:** Version bump only for package @ui5/webcomponents-tools
78
+
79
+
80
+
81
+
82
+
83
+ ## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
84
+
85
+ **Note:** Version bump only for package @ui5/webcomponents-tools
86
+
87
+
88
+
89
+
90
+
91
+ # [1.1.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.2...v1.1.0) (2022-01-21)
92
+
93
+
94
+ **Note:** Version bump only for package @ui5/webcomponents-tools
95
+
96
+
97
+
98
+
99
+
100
+ ## [1.0.2](https://github.com/SAP/ui5-webcomponents/compare/v1.0.1...v1.0.2) (2021-11-29)
101
+
102
+ **Note:** Version bump only for package @ui5/webcomponents-tools
103
+
104
+
105
+
106
+
107
+
108
+ ## [1.0.1](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0...v1.0.1) (2021-11-10)
109
+
110
+ **Note:** Version bump only for package @ui5/webcomponents-tools
111
+
112
+
113
+
114
+
115
+
116
+ # [1.0.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.16...v1.0.0) (2021-11-10)
117
+
118
+
119
+ **Note:** Version bump only for package @ui5/webcomponents-tools
120
+
121
+
122
+ # [1.0.0-rc.16](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.15...v1.0.0-rc.16) (2021-11-09)
123
+
124
+
125
+
126
+ ### Features
127
+
128
+ * **tools:** create an npm init script ([#4090](https://github.com/SAP/ui5-webcomponents/issues/4090)) ([5608e04](https://github.com/SAP/ui5-webcomponents/commit/5608e04))
129
+
130
+
131
+
6
132
  # [1.0.0-rc.15](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.14...v1.0.0-rc.15) (2021-07-23)
7
133
 
8
134
 
package/README.md CHANGED
@@ -17,7 +17,7 @@ used by other UI5 Web Components packages, such as `main` and `fiori`.
17
17
  We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/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/).
18
18
 
19
19
  ## Contribute
20
- Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/CONTRIBUTING.md).
20
+ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/docs/6-contributing/02-conventions-and-guidelines.md).
21
21
 
22
22
  ## License
23
23
  Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
package/assets-meta.js CHANGED
@@ -8,7 +8,12 @@ const assetsMeta = {
8
8
  "sap_belize_hcb",
9
9
  "sap_belize_hcw",
10
10
  "sap_fiori_3_hcb",
11
- "sap_fiori_3_hcw"
11
+ "sap_fiori_3_hcw",
12
+ "sap_horizon",
13
+ "sap_horizon_dark",
14
+ "sap_horizon_hcb",
15
+ "sap_horizon_hcw",
16
+ "sap_horizon_exp"
12
17
  ]
13
18
  },
14
19
  "languages": {
@@ -131,6 +136,7 @@ const assetsMeta = {
131
136
  "sk",
132
137
  "sl",
133
138
  "sr",
139
+ "sr_Latn",
134
140
  "sv",
135
141
  "th",
136
142
  "tr",
@@ -2,29 +2,33 @@ const path = require("path");
2
2
  const fs = require("fs");
3
3
 
4
4
  const LIB = path.join(__dirname, `../lib/`);
5
- const polyfillDir = path.dirname(require.resolve("@webcomponents/webcomponentsjs"));
6
- const polyfillPath = path.join(polyfillDir, "{*.js,*.map,*.md,bundles/**/*.*}");
7
5
  const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
8
6
 
9
7
  const getScripts = (options) => {
10
8
 
11
9
  const port = options.port || 8080; // preferred port
12
10
  const portStep = options.portStep || 1; // step to check for available ports, if preferred port is already used
11
+ let illustrations = options.illustrationsData || [];
12
+
13
+ illustrations = illustrations.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
14
+
15
+ let illustrationsScript = illustrations.join(" && ");
13
16
 
14
17
  const scripts = {
15
18
  clean: "rimraf dist && rimraf .port",
16
19
  lint: "eslint . --config config/.eslintrc.js",
17
20
  lintfix: "eslint . --config config/.eslintrc.js --fix",
18
21
  prepare: {
19
- default: "nps clean build.templates build.styles build.i18n build.jsonImports copy build.samples",
20
- es5: "nps clean build.templates build.styles build.i18n build.jsonImports copy.es5 build.samples"
22
+ default: "nps clean prepare.all",
23
+ all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.samples" "nps build.illustrations"',
24
+ styleRelated: "nps build.styles build.jsonImports",
21
25
  },
22
26
  build: {
23
- default: "nps lint prepare.es5 build.bundle",
27
+ default: "nps lint prepare build.bundle",
24
28
  templates: `mkdirp dist/generated/templates && node "${LIB}/hbs2ui5/index.js" -d src/ -o dist/generated/templates`,
25
29
  styles: {
26
30
  default: "nps build.styles.themes build.styles.components",
27
- themes: "postcss src/**/parameters-bundle.css --config config/postcss.themes --base src --dir dist/css/",
31
+ themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
28
32
  components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
29
33
  },
30
34
  i18n: {
@@ -37,32 +41,26 @@ const getScripts = (options) => {
37
41
  themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes dist/generated/json-imports`,
38
42
  i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
39
43
  },
40
- bundle: "rollup --config config/rollup.config.js --environment ES5_BUILD",
44
+ bundle: "rollup --config config/rollup.config.js",
41
45
  samples: {
42
46
  default: "nps build.samples.api build.samples.docs",
43
47
  api: `jsdoc -c "${LIB}/jsdoc/config.json"`,
44
48
  docs: `node "${LIB}/documentation/index.js" dist/api.json`,
45
- }
49
+ },
50
+ illustrations: illustrationsScript
46
51
  },
47
52
  copy: {
48
- default: "nps copy.src copy.props copy.test copy.webcomponents-polyfill-placeholder",
49
- es5: "nps copy.src copy.props copy.test copy.webcomponents-polyfill",
53
+ default: "nps copy.src copy.props copy.test",
50
54
  src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
51
55
  props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
52
56
  test: `node "${LIB}/copy-and-watch/index.js" --silent "test/**/*.*" dist/test-resources`,
53
- "webcomponents-polyfill": `node "${LIB}/copy-and-watch/index.js" --silent "${polyfillPath}" dist/webcomponentsjs/`,
54
- "webcomponents-polyfill-placeholder": `node ${LIB}/polyfill-placeholder/index.js`
55
57
  },
56
58
  watch: {
57
59
  default: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle" "nps watch.styles" "nps watch.i18n"',
58
- es5: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle.es5" "nps watch.styles" "nps watch.i18n"',
59
60
  src: 'nps "copy.src --watch --safe --skip-initial-copy"',
60
61
  props: 'nps "copy.props --watch --safe --skip-initial-copy"',
61
62
  test: 'nps "copy.test --watch --safe --skip-initial-copy"',
62
- bundle: {
63
- default: 'rollup --config config/rollup.config.js -w --environment DEV,DEPLOY_PUBLIC_PATH:/resources/',
64
- es5: 'rollup --config config/rollup.config.js -w --environment ES5_BUILD,DEV,DEPLOY_PUBLIC_PATH:/resources/'
65
- },
63
+ bundle: 'rollup --config config/rollup.config.js -w --environment DEV',
66
64
  styles: {
67
65
  default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
68
66
  themes: 'nps "build.styles.themes -w"',
@@ -76,10 +74,7 @@ const getScripts = (options) => {
76
74
  samples: 'chokidar "test/**/*.sample.html" -c "nps build.samples"',
77
75
  i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
78
76
  },
79
- dev: {
80
- default: 'concurrently "nps serve" "nps watch"',
81
- es5: 'concurrently "nps serve" "nps watch.es5"'
82
- },
77
+ dev: 'concurrently "nps serve" "nps watch"',
83
78
  start: "nps prepare dev",
84
79
  serve: `node "${LIB}/serve/index.js" --dir="dist/" --port=${port} --portStep=${portStep} --packageName="${packageName}"`,
85
80
  test: {
@@ -100,7 +95,7 @@ const getScripts = (options) => {
100
95
  },
101
96
  dev: 'concurrently "nps serve" "nps scope.watch"',
102
97
  watch: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.props" "nps scope.bundle" "nps watch.styles"',
103
- bundle: 'rollup --config config/rollup.config.js -w --environment ES5_BUILD,DEV,SCOPE'
98
+ bundle: 'rollup --config config/rollup.config.js -w --environment DEV,SCOPE'
104
99
  }
105
100
  };
106
101
 
@@ -1,8 +1,11 @@
1
1
  const postcssImport = require('postcss-import');
2
- const combineSelectors = require('postcss-combine-duplicated-selectors');
2
+ const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
3
3
  const postcssCSStoJSON = require('../lib/postcss-css-to-json/index.js');
4
4
  const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
5
5
  const cssnano = require('cssnano');
6
+ const fs = require("fs");
7
+
8
+ const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
6
9
 
7
10
  module.exports = {
8
11
  plugins: [
@@ -17,7 +20,7 @@ module.exports = {
17
20
  },
18
21
  ]
19
22
  },),
20
- postcssCSStoJSON({toReplace: 'src'}),
21
- postcssCSStoESM({toReplace: 'src'}),
23
+ postcssCSStoJSON({toReplace: 'src', packageName}),
24
+ postcssCSStoESM({toReplace: 'src', packageName}),
22
25
  ]
23
26
  };
@@ -0,0 +1,15 @@
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,18 +1,16 @@
1
1
  const process = require("process");
2
2
  const fs = require("fs");
3
3
  const os = require("os");
4
- const { babel } = require("@rollup/plugin-babel");
5
4
  const { nodeResolve } = require("@rollup/plugin-node-resolve");
6
- const url = require("@rollup/plugin-url");
7
5
  const { terser } = require("rollup-plugin-terser");
8
6
  const json = require("@rollup/plugin-json");
9
- const colors = require("colors/safe");
10
- const filesize = require("rollup-plugin-filesize");
7
+ const replace = require("@rollup/plugin-replace");
8
+ const colors = require("cli-color");
11
9
  const livereload = require("rollup-plugin-livereload");
10
+ const emptyModulePlugin = require("./rollup-plugins/empty-module.js");
12
11
 
13
12
  const packageFile = JSON.parse(fs.readFileSync("./package.json"));
14
13
  const packageName = packageFile.name;
15
- const DEPLOY_PUBLIC_PATH = process.env.DEPLOY_PUBLIC_PATH || "";
16
14
 
17
15
  const warningsToSkip = [{
18
16
  warningCode: "THIS_IS_UNDEFINED",
@@ -69,60 +67,35 @@ function ui5DevReadyMessagePlugin() {
69
67
  };
70
68
  }
71
69
 
72
- const getPlugins = ({ transpile }) => {
70
+ const getPlugins = () => {
73
71
  const plugins = [];
74
- if (!process.env.DEV) {
75
- plugins.push(filesize(
76
- {
77
- reporter(options, bundle, {
78
- minSize, gzipSize, brotliSize, bundleSize,
79
- fileName,
80
- // "showBeforeSizes: release"
81
- lastVersion,
82
- // "showBeforeSizes: "release" or "showBeforeSizes": "build"
83
- bundleSizeBefore, brotliSizeBefore, minSizeBefore, gzipSizeBefore,
84
- }) {
85
- // If a promise is returned, it will be awaited before rendering.
86
- return `${fileName.padEnd(35)} ${minSize} / gzipped: ${gzipSize}`;
87
- },
88
- },
89
-
90
- ));
91
- }
92
-
93
- const publicPath = DEPLOY_PUBLIC_PATH;
94
72
 
95
- plugins.push(ui5DevImportCheckerPlugin());
96
-
97
- if (!transpile) {
98
- plugins.push(json({
99
- include: [
100
- /.*assets\/.*\.json/,
101
- ],
102
- namedExports: false,
73
+ if (process.env.DEV) {
74
+ plugins.push(replace({
75
+ values: {
76
+ 'const DEV_MODE = false': 'const DEV_MODE = true',
77
+ },
78
+ preventAssignment: false,
103
79
  }));
104
80
  }
105
81
 
106
- if (transpile) {
107
- plugins.push(url({
108
- limit: 0,
109
- include: [
110
- /.*assets\/.*\.json/,
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",
111
87
  ],
112
- emitFiles: true,
113
- fileName: "[name].[hash][extname]",
114
- publicPath,
115
88
  }));
116
89
  }
117
90
 
118
- if (transpile) {
119
- plugins.push(babel({
120
- presets: ["@babel/preset-env"],
121
- exclude: /node_modules\/(?!(lit-html|@ui5\/webcomponents))/, // exclude all node_modules/ except lit-html and all starting with @ui5/webcomponents
122
- sourcemap: true,
123
- babelHelpers: "bundled",
124
- }));
125
- }
91
+ plugins.push(ui5DevImportCheckerPlugin());
92
+
93
+ plugins.push(json({
94
+ include: [
95
+ /.*assets\/.*\.json/,
96
+ ],
97
+ namedExports: false,
98
+ }));
126
99
 
127
100
  plugins.push(nodeResolve());
128
101
 
@@ -132,7 +105,7 @@ const getPlugins = ({ transpile }) => {
132
105
  }));
133
106
  }
134
107
 
135
- const es6DevMain = process.env.DEV && !transpile && packageName === "@ui5/webcomponents";
108
+ const es6DevMain = process.env.DEV && packageName === "@ui5/webcomponents";
136
109
  if (es6DevMain && os.platform() !== "win32") {
137
110
  plugins.push(livereload({
138
111
  watch: [
@@ -158,58 +131,19 @@ const getES6Config = (input = "bundle.esm.js") => {
158
131
  format: "esm",
159
132
  sourcemap: true,
160
133
  },
161
- moduleContext: id => {
162
- if (typeof id === "string" && id.includes("url-search-params-polyfill")) {
163
- // suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
164
- return "window";
165
- }
166
- },
167
134
  watch: {
168
135
  clearScreen: false,
169
136
  },
170
- plugins: getPlugins({ transpile: false }),
171
- onwarn: onwarn,
172
- }];
173
- };
174
-
175
- const getES5Config = (input = "bundle.es5.js") => {
176
- return [{
177
- input,
178
- output: {
179
- dir: "dist/resources",
180
- format: "iife",
181
- inlineDynamicImports: true,
182
- name: "sap-ui-webcomponents-bundle",
183
- extend: "true", // Whether or not to extend the global variable defined by the name option in umd or iife formats.
184
- sourcemap: true,
185
- },
186
- moduleContext: id => {
187
- if (id.includes("url-search-params-polyfill")) {
188
- // suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
189
- return "window";
190
- }
191
- },
192
- watch: {
193
- clearScreen: false,
194
- },
195
- plugins: getPlugins({ transpile: true }),
137
+ plugins: getPlugins(),
196
138
  onwarn: onwarn,
197
139
  }];
198
140
  };
199
141
 
200
142
  let config = getES6Config();
201
143
 
202
- if (process.env.ES5_BUILD && fs.existsSync("bundle.es5.js")) {
203
- config = config.concat(getES5Config());
204
- }
205
-
206
144
  if (process.env.SCOPE) {
207
145
  if (fs.existsSync("bundle.scoped.esm.js")) {
208
146
  config = config.concat(getES6Config("bundle.scoped.esm.js"));
209
-
210
- if (fs.existsSync("bundle.scoped.es5.js") && process.env.ES5_BUILD) {
211
- config = config.concat(getES5Config("bundle.scoped.es5.js"));
212
- }
213
147
  }
214
148
  }
215
149
 
@@ -152,9 +152,9 @@ exports.config = {
152
152
  * @param {Array.<Object>} capabilities list of capabilities details
153
153
  * @param {Array.<String>} specs List of spec file paths that are to be run
154
154
  */
155
- before: function (capabilities, specs) {
156
- browser.addCommand("isFocusedDeep", function () {
157
- return browser.execute(function (elem) {
155
+ before: async function (capabilities, specs) {
156
+ await browser.addCommand("isFocusedDeep", async function () {
157
+ return browser.executeAsync(function (elem, done) {
158
158
  let activeElement = document.activeElement;
159
159
 
160
160
  while (activeElement.shadowRoot) {
@@ -164,47 +164,69 @@ exports.config = {
164
164
  break;
165
165
  }
166
166
  }
167
- return elem === activeElement;
167
+ done(elem === activeElement);
168
168
  }, this);
169
169
  }, true);
170
170
 
171
- browser.addCommand("setProperty", function(property, value) {
172
- return browser.execute((elem, property, value) => {
173
- return elem[property] = value;
171
+ await browser.addCommand("isFocusedDeepElement", async function (element) {
172
+ return browser.executeAsync(function (elem, element, done) {
173
+ let activeElement = document.activeElement;
174
+
175
+ while (activeElement.shadowRoot) {
176
+ if (activeElement.shadowRoot.activeElement) {
177
+ activeElement = activeElement.shadowRoot.activeElement;
178
+ } else {
179
+ break;
180
+ }
181
+ }
182
+ done(element === activeElement);
183
+ }, this, element);
184
+ }, true);
185
+
186
+ await browser.addCommand("setProperty", async function(property, value) {
187
+ return browser.executeAsync((elem, property, value, done) => {
188
+ elem[property] = value;
189
+ done();
174
190
  }, this, property, value);
175
191
  }, true);
176
192
 
177
- browser.addCommand("setAttribute", function(attribute, value) {
178
- return browser.execute((elem, attribute, value) => {
179
- return elem.setAttribute(attribute, value);
193
+ await browser.addCommand("setAttribute", async function(attribute, value) {
194
+ return browser.executeAsync((elem, attribute, value, done) => {
195
+ elem.setAttribute(attribute, value);
196
+ done();
180
197
  }, this, attribute, value);
181
198
  }, true);
182
199
 
183
- browser.addCommand("removeAttribute", function(attribute) {
184
- return browser.execute((elem, attribute) => {
185
- return elem.removeAttribute(attribute);
200
+ await browser.addCommand("removeAttribute", async function(attribute) {
201
+ return browser.executeAsync((elem, attribute, done) => {
202
+ elem.removeAttribute(attribute);
203
+ done();
186
204
  }, this, attribute);
187
205
  }, true);
188
206
 
189
- browser.addCommand("hasClass", function(className) {
190
- return browser.execute((elem, className) => {
191
- return elem.classList.contains(className);
207
+ await browser.addCommand("hasClass", async function(className) {
208
+ return browser.executeAsync((elem, className, done) => {
209
+ done(elem.classList.contains(className));
192
210
  }, this, className);
193
211
  }, true);
194
212
 
195
- browser.addCommand("getStaticAreaItemClassName", function(selector) {
196
- return browser.execute(async (selector) => {
213
+ await browser.addCommand("getStaticAreaItemClassName", async function(selector) {
214
+ return browser.executeAsync(async (selector, done) => {
197
215
  const staticAreaItem = await document.querySelector(selector).getStaticAreaItemDomRef();
198
- return staticAreaItem.host.classList[0];
216
+ done(staticAreaItem.host.classList[0]);
199
217
  }, selector);
200
218
  }, false);
219
+
220
+ await browser.addLocatorStrategy('activeElement', (selector) => {
221
+ return document.querySelector(selector).shadowRoot.activeElement;
222
+ });
201
223
  },
202
224
  /**
203
225
  * Runs before a WebdriverIO command gets executed.
204
226
  * @param {String} commandName hook command name
205
227
  * @param {Array} args arguments that command would receive
206
228
  */
207
- beforeCommand: function (commandName, args) {
229
+ beforeCommand: async function (commandName, args) {
208
230
  const waitFor = [
209
231
  "$",
210
232
  "$$",
@@ -223,11 +245,12 @@ exports.config = {
223
245
  "isExisting",
224
246
  "isFocused",
225
247
  "isFocusedDeep", // custom
248
+ "isFocusedDeepElement", // custom
226
249
  "shadow$",
227
250
  "shadow$$",
228
251
  ];
229
252
  if (waitFor.includes(commandName)) {
230
- browser.executeAsync(function (done) {
253
+ await browser.executeAsync(function (done) {
231
254
  window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
232
255
  });
233
256
  }
@@ -277,12 +300,13 @@ exports.config = {
277
300
  * @param {Number} result 0 - command success, 1 - command error
278
301
  * @param {Object} error error object if any
279
302
  */
280
- afterCommand: function (commandName, args, result, error) {
303
+ afterCommand: async function (commandName, args, result, error) {
281
304
 
282
305
  // url -> set configuration first
283
306
  if (commandName === "url" && !args[0].includes("do-not-change-configuration")) {
284
- browser.execute(function() {
307
+ await browser.executeAsync(function(done) {
285
308
  window["sap-ui-webcomponents-bundle"].configuration.setNoConflict(true);
309
+ done();
286
310
  });
287
311
  }
288
312
 
@@ -295,15 +319,16 @@ exports.config = {
295
319
  "keys",
296
320
  "pause",
297
321
  "removeAttribute", // custom
322
+ "scrollIntoView",
298
323
  "setAttribute", // custom
299
324
  "setProperty", // custom
300
325
  "setValue",
301
326
  "setWindowSize",
302
327
  "touchAction",
303
- "url"
328
+ "url",
304
329
  ];
305
330
  if (waitFor.includes(commandName)) {
306
- browser.executeAsync(function (done) {
331
+ await browser.executeAsync(function (done) {
307
332
  window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
308
333
  });
309
334
  }