@ui5/webcomponents-tools 0.0.0-35e2c9666 → 0.0.0-37338d49d
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.
- package/CHANGELOG.md +1619 -0
- package/README.md +6 -9
- package/assets-meta.js +15 -10
- package/bin/dev.js +1 -5
- package/components-package/cypress/support/commands.js +39 -0
- package/components-package/cypress/support/component-index.html +17 -0
- package/components-package/cypress/support/component.d.ts +23 -0
- package/components-package/cypress/support/component.js +34 -0
- package/components-package/cypress.config.js +19 -0
- package/components-package/eslint.js +101 -2
- package/components-package/nps.js +109 -72
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -26
- package/components-package/vite.config.js +13 -0
- package/components-package/wdio.js +61 -15
- package/icons-collection/nps.js +13 -14
- package/lib/amd-to-es6/index.js +102 -0
- package/lib/amd-to-es6/no-remaining-require.js +33 -0
- package/lib/cem/custom-elements-manifest.config.mjs +544 -0
- package/lib/cem/event.mjs +168 -0
- package/lib/cem/schema-internal.json +1413 -0
- package/lib/cem/schema.json +1098 -0
- package/lib/cem/types-internal.d.ts +808 -0
- package/lib/cem/types.d.ts +736 -0
- package/lib/cem/utils.mjs +413 -0
- package/lib/cem/validate.js +70 -0
- package/lib/copy-and-watch/index.js +24 -1
- package/lib/copy-list/index.js +17 -17
- package/lib/create-icons/index.js +126 -72
- package/lib/create-illustrations/index.js +143 -111
- package/lib/create-new-component/Component.js +74 -0
- package/lib/create-new-component/ComponentTemplate.js +12 -0
- package/lib/create-new-component/index.js +60 -101
- package/lib/css-processors/css-processor-components.mjs +77 -0
- package/lib/css-processors/css-processor-themes.mjs +74 -0
- package/lib/css-processors/scope-variables.mjs +49 -0
- package/lib/css-processors/shared.mjs +56 -0
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/dev-server/dev-server.mjs +66 -0
- package/lib/dev-server/virtual-index-html-plugin.js +52 -0
- package/lib/generate-js-imports/illustrations.js +86 -0
- package/lib/generate-json-imports/i18n.js +58 -67
- package/lib/generate-json-imports/themes.js +36 -46
- package/lib/hbs2lit/src/compiler.js +24 -4
- package/lib/hbs2lit/src/includesReplacer.js +5 -5
- package/lib/hbs2lit/src/litVisitor2.js +85 -22
- package/lib/hbs2lit/src/svgProcessor.js +12 -5
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
- package/lib/hbs2ui5/index.js +57 -24
- package/lib/i18n/defaults.js +66 -57
- package/lib/i18n/toJSON.js +12 -11
- package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
- package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
- package/lib/scoping/get-all-tags.js +11 -11
- package/lib/scoping/lint-src.js +8 -7
- package/lib/scoping/scope-test-pages.js +2 -1
- package/lib/test-runner/test-runner.js +71 -0
- package/package.json +39 -32
- package/tsconfig.json +18 -0
- package/types/index.d.ts +1 -0
- package/components-package/rollup-plugins/empty-module.js +0 -15
- package/components-package/rollup.js +0 -239
- package/components-package/wdio.sync.js +0 -360
- package/lib/documentation/index.js +0 -165
- package/lib/documentation/templates/api-component-since.js +0 -3
- package/lib/documentation/templates/api-css-variables-section.js +0 -24
- package/lib/documentation/templates/api-events-section.js +0 -35
- package/lib/documentation/templates/api-methods-section.js +0 -26
- package/lib/documentation/templates/api-properties-section.js +0 -42
- package/lib/documentation/templates/api-slots-section.js +0 -28
- package/lib/documentation/templates/template.js +0 -39
- package/lib/esm-abs-to-rel/index.js +0 -54
- package/lib/hash/config.js +0 -10
- package/lib/hash/generate.js +0 -19
- package/lib/hash/upToDate.js +0 -31
- package/lib/jsdoc/config.json +0 -29
- package/lib/jsdoc/plugin.js +0 -2436
- package/lib/jsdoc/template/publish.js +0 -4112
- package/lib/polyfill-placeholder/index.js +0 -5
- package/lib/postcss-css-to-esm/index.js +0 -45
- package/lib/postcss-css-to-json/index.js +0 -36
- package/lib/postcss-new-files/index.js +0 -36
- package/lib/postcss-p/postcss-p.mjs +0 -11
- package/lib/replace-global-core/index.js +0 -20
- package/lib/serve/index.js +0 -46
- package/lib/serve/serve.json +0 -3
- package/package-lock.json +0 -48
@@ -1,26 +1 @@
|
|
1
|
-
|
2
|
-
const combineSelectors = require('postcss-combine-duplicated-selectors');
|
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 fs = require("fs");
|
7
|
-
|
8
|
-
const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
|
9
|
-
|
10
|
-
module.exports = {
|
11
|
-
plugins: [
|
12
|
-
postcssImport(),
|
13
|
-
combineSelectors({
|
14
|
-
removeDuplicatedProperties: true
|
15
|
-
}),
|
16
|
-
cssnano({
|
17
|
-
preset: [
|
18
|
-
'default', {
|
19
|
-
mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
|
20
|
-
},
|
21
|
-
]
|
22
|
-
},),
|
23
|
-
postcssCSStoJSON({toReplace: 'src', packageName}),
|
24
|
-
postcssCSStoESM({toReplace: 'src', packageName}),
|
25
|
-
]
|
26
|
-
};
|
1
|
+
module.exports = {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// vite.config.js
|
2
|
+
import { defineConfig } from 'vite';
|
3
|
+
import virtualIndex from '../lib/dev-server/virtual-index-html-plugin.js';
|
4
|
+
|
5
|
+
export default defineConfig(async () => {
|
6
|
+
const data = await virtualIndex();
|
7
|
+
return {
|
8
|
+
build: {
|
9
|
+
emptyOutDir: false,
|
10
|
+
},
|
11
|
+
plugins: [data],
|
12
|
+
}
|
13
|
+
})
|
@@ -1,3 +1,6 @@
|
|
1
|
+
const dns = require("node:dns");
|
2
|
+
const assert = require("chai").assert;
|
3
|
+
|
1
4
|
exports.config = {
|
2
5
|
//
|
3
6
|
// ====================
|
@@ -50,13 +53,22 @@ exports.config = {
|
|
50
53
|
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
51
54
|
// grid with only 5 firefox instances available you can make sure that not more than
|
52
55
|
// 5 instances get started at a time.
|
53
|
-
maxInstances:
|
56
|
+
maxInstances: 5,
|
54
57
|
//
|
55
58
|
browserName: 'chrome',
|
56
59
|
'goog:chromeOptions': {
|
57
60
|
// to run chrome headless the following flags are required
|
58
61
|
// (see https://developers.google.com/web/updates/2017/04/headless-chrome)
|
59
|
-
args: [
|
62
|
+
args: [
|
63
|
+
'--headless=old',
|
64
|
+
'--disable-search-engine-choice-screen',
|
65
|
+
'--start-maximized',
|
66
|
+
'--no-sandbox',
|
67
|
+
'--disable-gpu',
|
68
|
+
'--disable-infobars',
|
69
|
+
'--disable-extensions',
|
70
|
+
'--disable-dev-shm-usage',
|
71
|
+
],
|
60
72
|
// args: ['--disable-gpu'],
|
61
73
|
}
|
62
74
|
}],
|
@@ -82,7 +94,7 @@ exports.config = {
|
|
82
94
|
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
83
95
|
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
84
96
|
// gets prepended directly.
|
85
|
-
baseUrl:
|
97
|
+
baseUrl: 'http://localhost:4567', // This is important since WDIO 7+ does not accept an empty string for baseUrl
|
86
98
|
path: '',
|
87
99
|
//
|
88
100
|
// Default timeout for all waitFor* commands.
|
@@ -99,7 +111,13 @@ exports.config = {
|
|
99
111
|
// Services take over a specific job you don't want to take care of. They enhance
|
100
112
|
// your test setup with almost no effort. Unlike plugins, they don't add new
|
101
113
|
// commands. Instead, they hook themselves up into the test process.
|
102
|
-
services: ['chromedriver'
|
114
|
+
services: ['chromedriver', ['static-server', {
|
115
|
+
folders: [
|
116
|
+
{ mount: '/', path: './dist' },
|
117
|
+
],
|
118
|
+
port: '4567',
|
119
|
+
}],
|
120
|
+
],
|
103
121
|
// options
|
104
122
|
chromeDriverArgs: ['--port=9515'], // default
|
105
123
|
// Framework you want to run your specs with.
|
@@ -146,6 +164,9 @@ exports.config = {
|
|
146
164
|
*/
|
147
165
|
// beforeSession: function (config, capabilities, specs) {
|
148
166
|
// },
|
167
|
+
beforeSession: () => {
|
168
|
+
dns.setDefaultResultOrder('ipv4first');
|
169
|
+
},
|
149
170
|
/**
|
150
171
|
* Gets executed before test execution begins. At this point you can access to all global
|
151
172
|
* variables like `browser`. It is the perfect place to define custom commands.
|
@@ -210,12 +231,17 @@ exports.config = {
|
|
210
231
|
}, this, className);
|
211
232
|
}, true);
|
212
233
|
|
213
|
-
await browser.addCommand("
|
214
|
-
return browser.executeAsync(
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
234
|
+
await browser.addCommand("hasAttribute", async function(attrName) {
|
235
|
+
return browser.executeAsync((elem, attrName, done) => {
|
236
|
+
done(elem.hasAttribute(attrName));
|
237
|
+
}, this, attrName);
|
238
|
+
}, true);
|
239
|
+
|
240
|
+
await browser.addCommand("matches", async function(selector) {
|
241
|
+
return browser.executeAsync((elem, selector, done) => {
|
242
|
+
done(elem.matches(selector));
|
243
|
+
}, this, selector);
|
244
|
+
}, true);
|
219
245
|
|
220
246
|
await browser.addLocatorStrategy('activeElement', (selector) => {
|
221
247
|
return document.querySelector(selector).shadowRoot.activeElement;
|
@@ -231,11 +257,12 @@ exports.config = {
|
|
231
257
|
"$",
|
232
258
|
"$$",
|
233
259
|
"getAttribute",
|
260
|
+
"hasAttribute", // custom
|
261
|
+
"matches", // custom
|
234
262
|
"getCSSProperty",
|
235
263
|
"getHTML",
|
236
264
|
"getProperty",
|
237
265
|
"getSize",
|
238
|
-
"getStaticAreaItemClassName", // custom
|
239
266
|
"getText",
|
240
267
|
"getValue",
|
241
268
|
"hasClass", // custom
|
@@ -247,7 +274,7 @@ exports.config = {
|
|
247
274
|
"isFocusedDeep", // custom
|
248
275
|
"isFocusedDeepElement", // custom
|
249
276
|
"shadow$",
|
250
|
-
"shadow$$"
|
277
|
+
"shadow$$"
|
251
278
|
];
|
252
279
|
if (waitFor.includes(commandName)) {
|
253
280
|
await browser.executeAsync(function (done) {
|
@@ -284,8 +311,17 @@ exports.config = {
|
|
284
311
|
* Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
285
312
|
* @param {Object} test test details
|
286
313
|
*/
|
287
|
-
|
288
|
-
|
314
|
+
afterTest: async function (test) {
|
315
|
+
// fetch the browser logs and fail the test if there are `console.error` messages with the `[UI5-FWK]` marker
|
316
|
+
const logs = await browser.getLogs('browser');
|
317
|
+
const severeLogs = logs
|
318
|
+
.filter(l => l.level === "SEVERE" && l.message.includes("[UI5-FWK]"))
|
319
|
+
.map(l => l.message);
|
320
|
+
|
321
|
+
if (severeLogs.length) {
|
322
|
+
test.callback(new Error(`[${test.title}]\n\n ${severeLogs.join("\n ")}`));
|
323
|
+
}
|
324
|
+
},
|
289
325
|
/**
|
290
326
|
* Hook that gets executed after the suite has ended
|
291
327
|
* @param {Object} suite suite details
|
@@ -316,7 +352,6 @@ exports.config = {
|
|
316
352
|
"click",
|
317
353
|
"doubleClick",
|
318
354
|
"dragAndDrop",
|
319
|
-
"keys",
|
320
355
|
"pause",
|
321
356
|
"removeAttribute", // custom
|
322
357
|
"scrollIntoView",
|
@@ -327,10 +362,21 @@ exports.config = {
|
|
327
362
|
"touchAction",
|
328
363
|
"url",
|
329
364
|
];
|
365
|
+
|
366
|
+
const waitForWithDelay = [
|
367
|
+
"keys",
|
368
|
+
];
|
369
|
+
|
330
370
|
if (waitFor.includes(commandName)) {
|
331
371
|
await browser.executeAsync(function (done) {
|
332
372
|
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
333
373
|
});
|
374
|
+
} else if (waitForWithDelay.includes(commandName)) {
|
375
|
+
await browser.executeAsync(function (done) {
|
376
|
+
setTimeout(() => {
|
377
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
378
|
+
}, 10);
|
379
|
+
});
|
334
380
|
}
|
335
381
|
},
|
336
382
|
/**
|
package/icons-collection/nps.js
CHANGED
@@ -1,9 +1,4 @@
|
|
1
1
|
const path = require("path");
|
2
|
-
const resolve = require("resolve");
|
3
|
-
|
4
|
-
const generateHash = resolve.sync("@ui5/webcomponents-tools/lib/hash/generate.js");
|
5
|
-
const hashIsUpToDate = resolve.sync("@ui5/webcomponents-tools/lib/hash/upToDate.js");
|
6
|
-
const UP_TO_DATE = `node "${hashIsUpToDate}" dist/ hash.txt && echo "Up to date."`;
|
7
2
|
|
8
3
|
const LIB = path.join(__dirname, `../lib/`);
|
9
4
|
|
@@ -26,7 +21,7 @@ const copyIconAssetsCommand = (options) => {
|
|
26
21
|
return {
|
27
22
|
default: "nps copy.json-imports copy.icon-collection",
|
28
23
|
"json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
29
|
-
"icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json"
|
24
|
+
"icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json" src/generated/assets/`,
|
30
25
|
}
|
31
26
|
}
|
32
27
|
|
@@ -37,7 +32,7 @@ const copyIconAssetsCommand = (options) => {
|
|
37
32
|
|
38
33
|
options.versions.forEach((v) => {
|
39
34
|
command.default += ` copy.icon-collection${v}`;
|
40
|
-
command[`icon-collection${v}`] = `node "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json"
|
35
|
+
command[`icon-collection${v}`] = `node "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json" src/generated/assets/${v}/`;
|
41
36
|
});
|
42
37
|
|
43
38
|
return command;
|
@@ -46,24 +41,28 @@ const copyIconAssetsCommand = (options) => {
|
|
46
41
|
const getScripts = (options) => {
|
47
42
|
const createJSImportsCmd = createIconImportsCommand(options);
|
48
43
|
const copyAssetsCmd = copyIconAssetsCommand(options);
|
44
|
+
const tsCommand = !options.legacy ? "tsc --build" : "";
|
45
|
+
const tsCrossEnv = !options.legacy ? "cross-env UI5_TS=true" : "";
|
49
46
|
|
50
47
|
const scripts = {
|
51
|
-
clean: "rimraf dist",
|
48
|
+
clean: "rimraf dist && rimraf src/generated",
|
52
49
|
copy: copyAssetsCmd,
|
50
|
+
generate: `${tsCrossEnv} nps clean copy build.i18n build.icons build.jsonImports copyjson`,
|
51
|
+
copyjson: "copy-and-watch \"src/generated/**/*.json\" dist/generated/",
|
53
52
|
build: {
|
54
|
-
default: `${
|
53
|
+
default: `${tsCrossEnv} nps clean copy build.i18n typescript build.icons build.jsonImports`,
|
55
54
|
i18n: {
|
56
55
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
57
|
-
defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n
|
58
|
-
json: `mkdirp
|
56
|
+
defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
57
|
+
json: `mkdirp src/generated/assets/i18n && node "${LIB}/i18n/toJSON.js" src/i18n src/generated/assets/i18n`,
|
59
58
|
},
|
60
59
|
jsonImports: {
|
61
|
-
default: "mkdirp
|
62
|
-
i18n: `node "${LIB}/generate-json-imports/i18n.js"
|
60
|
+
default: "mkdirp src/generated/json-imports && nps build.jsonImports.i18n",
|
61
|
+
i18n: `node "${LIB}/generate-json-imports/i18n.js" src/generated/assets/i18n src/generated/json-imports`,
|
63
62
|
},
|
64
63
|
icons: createJSImportsCmd,
|
65
64
|
},
|
66
|
-
|
65
|
+
typescript: tsCommand,
|
67
66
|
};
|
68
67
|
|
69
68
|
return scripts;
|
@@ -0,0 +1,102 @@
|
|
1
|
+
const fs = require("fs").promises;
|
2
|
+
const path = require("path");
|
3
|
+
const basePath = process.argv[2];
|
4
|
+
const babelCore = require("@babel/core");
|
5
|
+
const babelParser = require("@babel/parser");
|
6
|
+
const babelGenerator = require("@babel/generator").default;
|
7
|
+
const replaceAsync = require('replace-in-file');
|
8
|
+
|
9
|
+
const convertSAPUIDefineToDefine = async (filePath) => {
|
10
|
+
return replaceAsync({
|
11
|
+
files: filePath,
|
12
|
+
processor: (input) => {
|
13
|
+
return input.replace("sap.ui.define", "define").replace(", /* bExport= */ false", "").replace(", /* bExport= */ true", "");
|
14
|
+
}
|
15
|
+
})
|
16
|
+
}
|
17
|
+
|
18
|
+
const convertAmdToEs6 = async (code) => {
|
19
|
+
return (await babelCore.transformAsync(code, {
|
20
|
+
plugins: [['babel-plugin-amd-to-esm', {}]]
|
21
|
+
})).code;
|
22
|
+
}
|
23
|
+
|
24
|
+
const convertAbsImportsToRelative = (filePath, code) => {
|
25
|
+
let changed = false;
|
26
|
+
// console.log("File processing started: ", srcPath);
|
27
|
+
|
28
|
+
if (code.includes("import(")) {
|
29
|
+
// esprima can't parse this, but it's from the project files
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
const tree = babelParser.parse(code, { sourceType: "module" });
|
34
|
+
const importer = filePath.replace(basePath, "");
|
35
|
+
const importerDir = path.dirname(importer);
|
36
|
+
// console.log("Importer -> ", importer);
|
37
|
+
|
38
|
+
tree?.program?.body?.forEach(node => {
|
39
|
+
if (node.type === "ImportDeclaration") {
|
40
|
+
let importee = node.source.value;
|
41
|
+
// console.log(importee);
|
42
|
+
if (importee.startsWith(".")) {
|
43
|
+
// add .js extension if missing
|
44
|
+
if (!importee.endsWith(".js")) {
|
45
|
+
node.source.value += ".js"
|
46
|
+
changed = true;
|
47
|
+
}
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
let importeeDir = path.dirname(importee);
|
51
|
+
let importeeFile = path.basename(importee);
|
52
|
+
let relativePath = path.relative(importerDir, importeeDir);
|
53
|
+
if (relativePath.length === 0) {
|
54
|
+
relativePath = "."
|
55
|
+
}
|
56
|
+
if (!relativePath.startsWith(".")) {
|
57
|
+
relativePath = "./" + relativePath;
|
58
|
+
}
|
59
|
+
|
60
|
+
relativePath = relativePath.replace(/\\/g, "/"); // the browser expects unix paths
|
61
|
+
let relativeImport = `${relativePath}/${importeeFile}.js`;
|
62
|
+
// console.log(importee + " --> " + relativeImport);
|
63
|
+
node.source.value = relativeImport;
|
64
|
+
changed = true;
|
65
|
+
}
|
66
|
+
});
|
67
|
+
|
68
|
+
return changed ? babelGenerator(tree).code : code;
|
69
|
+
}
|
70
|
+
|
71
|
+
const replaceGlobalCoreUsage = (filePath, code) => {
|
72
|
+
if (!filePath.includes("Configuration")) {
|
73
|
+
const replaced = code.replace(/sap\.ui\.getCore\(\)/g, `Core`);
|
74
|
+
return code !== replaced ? `import Core from 'sap/ui/core/Core';${replaced}` : code;
|
75
|
+
}
|
76
|
+
|
77
|
+
return code;
|
78
|
+
};
|
79
|
+
|
80
|
+
const transformAmdToES6Module = async (filePath) => {
|
81
|
+
await convertSAPUIDefineToDefine(filePath);
|
82
|
+
|
83
|
+
let code = (await fs.readFile(filePath)).toString();
|
84
|
+
|
85
|
+
code = await convertAmdToEs6(code);
|
86
|
+
|
87
|
+
code = replaceGlobalCoreUsage(filePath, code);
|
88
|
+
|
89
|
+
code = convertAbsImportsToRelative(filePath, code);
|
90
|
+
|
91
|
+
return fs.writeFile(filePath, code);
|
92
|
+
}
|
93
|
+
|
94
|
+
const transformAmdToES6Modules = async () => {
|
95
|
+
const { globby } = await import("globby");
|
96
|
+
const fileNames = await globby(basePath.replace(/\\/g, "/") + "**/*.js");
|
97
|
+
return Promise.all(fileNames.map(transformAmdToES6Module).filter(x => !!x));
|
98
|
+
};
|
99
|
+
|
100
|
+
transformAmdToES6Modules().then(() => {
|
101
|
+
console.log("Success: all amd modules are transformed to es6!");
|
102
|
+
});
|
@@ -0,0 +1,33 @@
|
|
1
|
+
const fs = require("fs").promises;
|
2
|
+
const path = require("path");
|
3
|
+
const basePath = process.argv[2];
|
4
|
+
const babelCore = require("@babel/core");
|
5
|
+
const babelParser = require("@babel/parser");
|
6
|
+
const babelGenerator = require("@babel/generator").default;
|
7
|
+
const walk = require("estree-walk");
|
8
|
+
|
9
|
+
const checkHasRequire = (filePath, code) => {
|
10
|
+
code = code.replace(/sap\.ui\.require/g, "unhandledRequire");
|
11
|
+
|
12
|
+
const tree = babelParser.parse(code, { sourceType: "module" });
|
13
|
+
walk(tree, {
|
14
|
+
CallExpression: function (node) {
|
15
|
+
if (node.type === "CallExpression" && node?.callee?.name === "unhandledRequire") {
|
16
|
+
throw new Error(`sap.ui.require found in ${filePath}`);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
});
|
20
|
+
}
|
21
|
+
|
22
|
+
const checkFile = async (filePath) => {
|
23
|
+
let code = (await fs.readFile(filePath)).toString();
|
24
|
+
checkHasRequire(filePath, code);
|
25
|
+
}
|
26
|
+
|
27
|
+
const checkAll = async () => {
|
28
|
+
const { globby } = await import("globby");
|
29
|
+
const fileNames = await globby(basePath.replace(/\\/g, "/") + "**/*.js");
|
30
|
+
return Promise.all(fileNames.map(checkFile).filter(x => !!x));
|
31
|
+
};
|
32
|
+
|
33
|
+
checkAll();
|