@ui5/webcomponents-tools 0.0.0-f24ff9019 → 0.0.0-f42e7c18c

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 (62) hide show
  1. package/CHANGELOG.md +955 -0
  2. package/README.md +3 -6
  3. package/assets-meta.js +5 -3
  4. package/components-package/cypress/support/commands.js +39 -0
  5. package/components-package/cypress/support/component-index.html +17 -0
  6. package/components-package/cypress/support/component.d.ts +23 -0
  7. package/components-package/cypress/support/component.js +34 -0
  8. package/components-package/cypress.config.js +19 -0
  9. package/components-package/eslint.js +90 -28
  10. package/components-package/nps.js +53 -45
  11. package/components-package/postcss.components.js +1 -24
  12. package/components-package/postcss.themes.js +1 -30
  13. package/components-package/wdio.js +415 -405
  14. package/icons-collection/nps.js +7 -5
  15. package/lib/amd-to-es6/index.js +102 -0
  16. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  17. package/lib/cem/custom-elements-manifest.config.mjs +527 -0
  18. package/lib/cem/event.mjs +168 -0
  19. package/lib/cem/schema-internal.json +1413 -0
  20. package/lib/cem/schema.json +1098 -0
  21. package/lib/cem/types-internal.d.ts +808 -0
  22. package/lib/cem/types.d.ts +736 -0
  23. package/lib/cem/utils.mjs +408 -0
  24. package/lib/cem/validate.js +70 -0
  25. package/lib/create-icons/index.js +8 -6
  26. package/lib/create-illustrations/index.js +40 -33
  27. package/lib/create-new-component/index.js +4 -13
  28. package/lib/create-new-component/tsFileContentTemplate.js +4 -13
  29. package/lib/css-processors/css-processor-components.mjs +77 -0
  30. package/lib/css-processors/css-processor-themes.mjs +79 -0
  31. package/lib/css-processors/scope-variables.mjs +49 -0
  32. package/lib/{postcss-css-to-esm/index.js → css-processors/shared.mjs} +36 -50
  33. package/lib/dev-server/custom-hot-update-plugin.js +4 -4
  34. package/lib/dev-server/{dev-server.js → dev-server.mjs} +4 -4
  35. package/lib/generate-js-imports/illustrations.js +17 -14
  36. package/lib/generate-json-imports/i18n.js +45 -61
  37. package/lib/generate-json-imports/themes.js +16 -33
  38. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +12 -7
  39. package/lib/hbs2ui5/index.js +3 -3
  40. package/lib/i18n/defaults.js +3 -2
  41. package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
  42. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  43. package/lib/scoping/get-all-tags.js +10 -3
  44. package/lib/scoping/lint-src.js +8 -7
  45. package/lib/scoping/scope-test-pages.js +2 -1
  46. package/package.json +19 -11
  47. package/tsconfig.json +16 -0
  48. package/types/index.d.ts +1 -0
  49. package/components-package/wdio.sync.js +0 -368
  50. package/lib/create-new-component/jsFileContentTemplate.js +0 -73
  51. package/lib/esm-abs-to-rel/index.js +0 -58
  52. package/lib/generate-custom-elements-manifest/index.js +0 -327
  53. package/lib/jsdoc/config.json +0 -29
  54. package/lib/jsdoc/configTypescript.json +0 -29
  55. package/lib/jsdoc/plugin.js +0 -2468
  56. package/lib/jsdoc/preprocess.js +0 -146
  57. package/lib/jsdoc/template/publish.js +0 -4120
  58. package/lib/postcss-css-to-json/index.js +0 -47
  59. package/lib/postcss-new-files/index.js +0 -36
  60. package/lib/postcss-p/postcss-p.mjs +0 -14
  61. package/lib/postcss-scope-vars/index.js +0 -24
  62. package/lib/replace-global-core/index.js +0 -25
@@ -1,368 +0,0 @@
1
- exports.config = {
2
- //
3
- // ====================
4
- // Runner Configuration
5
- // ====================
6
- //
7
- // WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
8
- // on a remote machine).
9
- runner: 'local',
10
-
11
- //
12
- // ==================
13
- // Specify Test Files
14
- // ==================
15
- // Define which test specs should run. The pattern is relative to the directory
16
- // from which `wdio` was called. Notice that, if you are calling `wdio` from an
17
- // NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
18
- // directory is where your package.json resides, so `wdio` will be called from there.
19
- //
20
- specs: [
21
- './test/specs/**/*.js'
22
- ],
23
- // Patterns to exclude.
24
- exclude: [
25
- // 'path/to/excluded/files'
26
- ],
27
- //
28
- // ============
29
- // Capabilities
30
- // ============
31
- // Define your capabilities here. WebdriverIO can run multiple capabilities at the same
32
- // time. Depending on the number of capabilities, WebdriverIO launches several test
33
- // sessions. Within your capabilities you can overwrite the spec and exclude options in
34
- // order to group specific specs to a specific capability.
35
- //
36
- // First, you can define how many instances should be started at the same time. Let's
37
- // say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
38
- // set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
39
- // files and you set maxInstances to 10, all spec files will get tested at the same time
40
- // and 30 processes will get spawned. The property handles how many capabilities
41
- // from the same test should run tests.
42
- //
43
- maxInstances: 10,
44
- //
45
- // If you have trouble getting all important capabilities together, check out the
46
- // Sauce Labs platform configurator - a great tool to configure your capabilities:
47
- // https://docs.saucelabs.com/reference/platforms-configurator
48
- //
49
- capabilities: [{
50
- // maxInstances can get overwritten per capability. So if you have an in-house Selenium
51
- // grid with only 5 firefox instances available you can make sure that not more than
52
- // 5 instances get started at a time.
53
- maxInstances: 5,
54
- //
55
- browserName: 'chrome',
56
- 'goog:chromeOptions': {
57
- // to run chrome headless the following flags are required
58
- // (see https://developers.google.com/web/updates/2017/04/headless-chrome)
59
- args: [
60
- '--headless',
61
- '--start-maximized',
62
- '--no-sandbox',
63
- '--disable-gpu',
64
- '--disable-infobars',
65
- '--disable-extensions',
66
- '--disable-dev-shm-usage',
67
- ],
68
- // args: ['--disable-gpu'],
69
- }
70
- }],
71
- //
72
- // port to find chromedriver
73
- port: 9515, // default
74
- // ===================
75
- // Test Configurations
76
- // ===================
77
- // Define all options that are relevant for the WebdriverIO instance here
78
- //
79
- // Level of logging verbosity: trace | debug | info | warn | error
80
- logLevel: 'error',
81
- //
82
- // Warns when a deprecated command is used
83
- deprecationWarnings: true,
84
- //
85
- // If you only want to run your tests until a specific amount of tests have failed use
86
- // bail (default is 0 - don't bail, run all tests).
87
- bail: 0,
88
- //
89
- // Set a base URL in order to shorten url command calls. If your `url` parameter starts
90
- // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
91
- // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
92
- // gets prepended directly.
93
- baseUrl: undefined, // This is important since WDIO 7+ does not accept an empty string for baseUrl
94
- path: '',
95
- //
96
- // Default timeout for all waitFor* commands.
97
- waitforTimeout: 10000,
98
- //
99
- // Default timeout in milliseconds for request
100
- // if Selenium Grid doesn't send response
101
- connectionRetryTimeout: 90000,
102
- //
103
- // Default request retries count
104
- connectionRetryCount: 3,
105
- //
106
- // Test runner services
107
- // Services take over a specific job you don't want to take care of. They enhance
108
- // your test setup with almost no effort. Unlike plugins, they don't add new
109
- // commands. Instead, they hook themselves up into the test process.
110
- services: ['chromedriver'],
111
- // options
112
- chromeDriverArgs: ['--port=9515'], // default
113
- // Framework you want to run your specs with.
114
- // The following are supported: Mocha, Jasmine, and Cucumber
115
- // see also: https://webdriver.io/docs/frameworks.html
116
- //
117
- // Make sure you have the wdio adapter package for the specific framework installed
118
- // before running any tests.
119
- framework: 'mocha',
120
- //
121
- // Test reporter for stdout.
122
- // The only one supported by default is 'dot'
123
- // see also: https://webdriver.io/docs/dot-reporter.html
124
- reporters: ['dot', 'spec'],
125
-
126
- //
127
- // Options to be passed to Mocha.
128
- // See the full list at http://mochajs.org/
129
- mochaOpts: {
130
- ui: 'bdd',
131
- timeout: 60000
132
- },
133
- //
134
- // =====
135
- // Hooks
136
- // =====
137
- // WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
138
- // it and to build services around it. You can either apply a single function or an array of
139
- // methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
140
- // resolved to continue.
141
- /**
142
- * Gets executed once before all workers get launched.
143
- * @param {Object} config wdio configuration object
144
- * @param {Array.<Object>} capabilities list of capabilities details
145
- */
146
- // onPrepare: function (config, capabilities) {
147
- // },
148
- /**
149
- * Gets executed just before initialising the webdriver session and test framework. It allows you
150
- * to manipulate configurations depending on the capability or spec.
151
- * @param {Object} config wdio configuration object
152
- * @param {Array.<Object>} capabilities list of capabilities details
153
- * @param {Array.<String>} specs List of spec file paths that are to be run
154
- */
155
- // beforeSession: function (config, capabilities, specs) {
156
- // },
157
- /**
158
- * Gets executed before test execution begins. At this point you can access to all global
159
- * variables like `browser`. It is the perfect place to define custom commands.
160
- * @param {Array.<Object>} capabilities list of capabilities details
161
- * @param {Array.<String>} specs List of spec file paths that are to be run
162
- */
163
- before: function (capabilities, specs) {
164
- browser.addCommand("isFocusedDeep", function () {
165
- return browser.execute(function (elem) {
166
- let activeElement = document.activeElement;
167
-
168
- while (activeElement.shadowRoot) {
169
- if (activeElement.shadowRoot.activeElement) {
170
- activeElement = activeElement.shadowRoot.activeElement;
171
- } else {
172
- break;
173
- }
174
- }
175
- return elem === activeElement;
176
- }, this);
177
- }, true);
178
-
179
- browser.addCommand("isFocusedDeepElement", function (element) {
180
- return browser.execute(function (elem, element, done) {
181
- let activeElement = document.activeElement;
182
-
183
- while (activeElement.shadowRoot) {
184
- if (activeElement.shadowRoot.activeElement) {
185
- activeElement = activeElement.shadowRoot.activeElement;
186
- } else {
187
- break;
188
- }
189
- }
190
- done(element === activeElement);
191
- }, this, element);
192
- }, true);
193
-
194
- browser.addCommand("setProperty", function(property, value) {
195
- return browser.execute((elem, property, value) => {
196
- return elem[property] = value;
197
- }, this, property, value);
198
- }, true);
199
-
200
- browser.addCommand("setAttribute", function(attribute, value) {
201
- return browser.execute((elem, attribute, value) => {
202
- return elem.setAttribute(attribute, value);
203
- }, this, attribute, value);
204
- }, true);
205
-
206
- browser.addCommand("removeAttribute", function(attribute) {
207
- return browser.execute((elem, attribute) => {
208
- return elem.removeAttribute(attribute);
209
- }, this, attribute);
210
- }, true);
211
-
212
- browser.addCommand("hasClass", function(className) {
213
- return browser.execute((elem, className) => {
214
- return elem.classList.contains(className);
215
- }, this, className);
216
- }, true);
217
-
218
- browser.addCommand("getStaticAreaItemClassName", function(selector) {
219
- return browser.execute(async (selector) => {
220
- const staticAreaItem = await document.querySelector(selector).getStaticAreaItemDomRef();
221
- return staticAreaItem.host.classList[0];
222
- }, selector);
223
- }, false);
224
- },
225
- /**
226
- * Runs before a WebdriverIO command gets executed.
227
- * @param {String} commandName hook command name
228
- * @param {Array} args arguments that command would receive
229
- */
230
- beforeCommand: function (commandName, args) {
231
- const waitFor = [
232
- "$",
233
- "$$",
234
- "getAttribute",
235
- "getCSSProperty",
236
- "getHTML",
237
- "getProperty",
238
- "getSize",
239
- "getStaticAreaItemClassName", // custom
240
- "getText",
241
- "getValue",
242
- "hasClass", // custom
243
- "isDisplayed",
244
- "isDisplayedInViewport",
245
- "isEnabled",
246
- "isExisting",
247
- "isFocused",
248
- "isFocusedDeep", // custom
249
- "isFocusedDeepElement", // custom
250
- "shadow$",
251
- "shadow$$",
252
- ];
253
- if (waitFor.includes(commandName)) {
254
- browser.executeAsync(function (done) {
255
- window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
256
- });
257
- }
258
- },
259
-
260
- /**
261
- * Hook that gets executed before the suite starts
262
- * @param {Object} suite suite details
263
- */
264
- // beforeSuite: function (suite) {
265
- // },
266
- /**
267
- * Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
268
- * @param {Object} test test details
269
- */
270
- // beforeTest: function (test) {
271
- // },
272
- /**
273
- * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
274
- * beforeEach in Mocha)
275
- */
276
- // beforeHook: function () {
277
- // },
278
- /**
279
- * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
280
- * afterEach in Mocha)
281
- */
282
- // afterHook: function () {
283
- // },
284
- /**
285
- * Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
286
- * @param {Object} test test details
287
- */
288
- // afterTest: function (test) {
289
- // },
290
- /**
291
- * Hook that gets executed after the suite has ended
292
- * @param {Object} suite suite details
293
- */
294
- // afterSuite: function (suite) {
295
- // },
296
-
297
- /**
298
- * Runs after a WebdriverIO command gets executed
299
- * @param {String} commandName hook command name
300
- * @param {Array} args arguments that command would receive
301
- * @param {Number} result 0 - command success, 1 - command error
302
- * @param {Object} error error object if any
303
- */
304
- afterCommand: function (commandName, args, result, error) {
305
-
306
- // url -> set configuration first
307
- if (commandName === "url" && !args[0].includes("do-not-change-configuration")) {
308
- browser.execute(function() {
309
- window["sap-ui-webcomponents-bundle"].configuration.setNoConflict(true);
310
- });
311
- }
312
-
313
- const waitFor = [
314
- "addValue",
315
- "clearValue",
316
- "click",
317
- "doubleClick",
318
- "dragAndDrop",
319
- "keys",
320
- "pause",
321
- "removeAttribute", // custom
322
- "setAttribute", // custom
323
- "setProperty", // custom
324
- "setValue",
325
- "setWindowSize",
326
- "touchAction",
327
- "url"
328
- ];
329
- if (waitFor.includes(commandName)) {
330
- browser.executeAsync(function (done) {
331
- window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
332
- });
333
- }
334
- },
335
- /**
336
- * Gets executed after all tests are done. You still have access to all global variables from
337
- * the test.
338
- * @param {Number} result 0 - test pass, 1 - test fail
339
- * @param {Array.<Object>} capabilities list of capabilities details
340
- * @param {Array.<String>} specs List of spec file paths that ran
341
- */
342
- // after: function (result, capabilities, specs) {
343
- // },
344
- /**
345
- * Gets executed right after terminating the webdriver session.
346
- * @param {Object} config wdio configuration object
347
- * @param {Array.<Object>} capabilities list of capabilities details
348
- * @param {Array.<String>} specs List of spec file paths that ran
349
- */
350
- // afterSession: function (config, capabilities, specs) {
351
- // },
352
- /**
353
- * Gets executed after all workers got shut down and the process is about to exit.
354
- * @param {Object} exitCode 0 - success, 1 - fail
355
- * @param {Object} config wdio configuration object
356
- * @param {Array.<Object>} capabilities list of capabilities details
357
- * @param {<Object>} results object containing test results
358
- */
359
- // onComplete: function(exitCode, config, capabilities, results) {
360
- // },
361
- /**
362
- * Gets executed when a refresh happens.
363
- * @param {String} oldSessionId session ID of the old session
364
- * @param {String} newSessionId session ID of the new session
365
- */
366
- //onReload: function(oldSessionId, newSessionId) {
367
- //}
368
- }
@@ -1,73 +0,0 @@
1
- const jsFileContentTemplate = (componentName, tagName, library, packageName) => {
2
- return `import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
3
- import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
4
- import ${componentName}Template from "./generated/templates/${componentName}Template.lit.js";
5
-
6
- // Styles
7
- import ${componentName}Css from "./generated/themes/${componentName}.css.js";
8
-
9
- /**
10
- * @public
11
- */
12
- const metadata = {
13
- tag: "${tagName}",
14
- properties: /** @lends sap.ui.webc.${library}.${componentName}.prototype */ {
15
- //
16
- },
17
- slots: /** @lends sap.ui.webc.${library}.${componentName}.prototype */ {
18
- //
19
- },
20
- events: /** @lends sap.ui.webc.${library}.${componentName}.prototype */ {
21
- //
22
- },
23
- };
24
-
25
- /**
26
- * @class
27
- *
28
- * <h3 class="comment-api-title">Overview</h3>
29
- *
30
- *
31
- * <h3>Usage</h3>
32
- *
33
- * For the <code>${tagName}</code>
34
- * <h3>ES6 Module Import</h3>
35
- *
36
- * <code>import ${packageName}/dist/${componentName}.js";</code>
37
- *
38
- * @constructor
39
- * @author SAP SE
40
- * @alias sap.ui.webc.${library}.${componentName}
41
- * @extends sap.ui.webc.base.UI5Element
42
- * @tagname ${tagName}
43
- * @public
44
- */
45
- class ${componentName} extends UI5Element {
46
- static get metadata() {
47
- return metadata;
48
- }
49
-
50
- static get render() {
51
- return litRender;
52
- }
53
-
54
- static get styles() {
55
- return ${componentName}Css;
56
- }
57
-
58
- static get template() {
59
- return ${componentName}Template;
60
- }
61
-
62
- static get dependencies() {
63
- return [];
64
- }
65
- }
66
-
67
- ${componentName}.define();
68
-
69
- export default ${componentName};
70
- `;
71
- };
72
-
73
- module.exports = jsFileContentTemplate;
@@ -1,58 +0,0 @@
1
- const esprima = require("esprima");
2
- const escodegen = require("escodegen");
3
-
4
- const fs = require("fs").promises;
5
- const path = require("path");
6
- const basePath = process.argv[2];
7
-
8
- const convertImports = async (srcPath) => {
9
- let changed = false;
10
- // console.log("scanning imports of", srcPath);
11
- let code = (await fs.readFile(srcPath)).toString();
12
- const tree = esprima.parseModule(code);
13
- const importer = srcPath.replace(basePath, "");
14
- const importerDir = path.dirname(importer);
15
- // console.log("-> ", importer);
16
- tree.body.forEach(node => {
17
- if (node.type === "ImportDeclaration") {
18
- let importee = node.source.value;
19
- if (importee.startsWith(".")) {
20
- // add .js extension if missing
21
- if (!importee.endsWith(".js")) {
22
- node.source.value += ".js"
23
- changed = true;
24
- }
25
- return;
26
- }
27
- let importeeDir = path.dirname(importee);
28
- let importeeFile = path.basename(importee);
29
- let relativePath = path.relative(importerDir, importeeDir);
30
- if (relativePath.length === 0) {
31
- relativePath = "."
32
- }
33
- if (!relativePath.startsWith(".")) {
34
- relativePath = "./" + relativePath;
35
- }
36
-
37
- relativePath = relativePath.replace(/\\/g, "/"); // the browser expects unix paths
38
- let relativeImport = `${relativePath}/${importeeFile}.js`;
39
- // console.log(importee + " --> " + relativeImport);
40
- node.source.value = relativeImport;
41
- changed = true;
42
- }
43
- });
44
-
45
- if (changed) {
46
- return fs.writeFile(srcPath, escodegen.generate(tree));
47
- }
48
- }
49
-
50
- const generate = async () => {
51
- const { globby } = await import("globby");
52
- const fileNames = await globby(basePath.replace(/\\/g, "/") + "**/*.js");
53
- return Promise.all(fileNames.map(convertImports).filter(x => !!x));
54
- };
55
-
56
- generate().then(() => {
57
- console.log("Success: Converted absolute imports to relative for files in:", basePath);
58
- });