@ui5/webcomponents-tools 0.0.0-fb61e9889 → 0.0.0-fca1107e7
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 +980 -0
- package/README.md +6 -6
- package/assets-meta.js +16 -3
- package/bin/dev.js +1 -5
- package/components-package/eslint.js +36 -0
- package/components-package/nps.js +108 -70
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -23
- package/components-package/vite.config.js +13 -0
- package/components-package/wdio.js +405 -353
- package/components-package/wdio.sync.js +26 -2
- package/icons-collection/nps.js +51 -18
- 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 +501 -0
- package/lib/cem/event.mjs +131 -0
- package/lib/cem/schema-internal.json +1357 -0
- package/lib/cem/schema.json +1098 -0
- package/lib/cem/types-internal.d.ts +796 -0
- package/lib/cem/types.d.ts +736 -0
- package/lib/cem/utils.mjs +384 -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 +124 -58
- package/lib/create-illustrations/index.js +153 -66
- package/lib/create-new-component/index.js +71 -104
- package/lib/create-new-component/jsFileContentTemplate.js +73 -0
- package/lib/create-new-component/tsFileContentTemplate.js +71 -0
- package/lib/css-processors/css-processor-component-styles.mjs +47 -0
- package/lib/css-processors/css-processor-components.mjs +77 -0
- package/lib/css-processors/css-processor-themes.mjs +79 -0
- package/lib/css-processors/scope-variables.mjs +49 -0
- package/lib/css-processors/shared.mjs +76 -0
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/dev-server/dev-server.js +66 -0
- package/lib/dev-server/virtual-index-html-plugin.js +52 -0
- package/lib/generate-custom-elements-manifest/index.js +271 -0
- package/lib/generate-js-imports/illustrations.js +86 -0
- package/lib/generate-json-imports/i18n.js +43 -31
- package/lib/generate-json-imports/themes.js +36 -24
- package/lib/hbs2lit/src/compiler.js +24 -4
- package/lib/hbs2lit/src/includesReplacer.js +5 -5
- package/lib/hbs2lit/src/litVisitor2.js +95 -24
- package/lib/hbs2lit/src/svgProcessor.js +12 -5
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +32 -4
- package/lib/hbs2ui5/index.js +56 -23
- package/lib/i18n/defaults.js +65 -57
- package/lib/i18n/toJSON.js +12 -11
- package/lib/jsdoc/configTypescript.json +29 -0
- package/lib/jsdoc/plugin.js +41 -0
- package/lib/jsdoc/preprocess.js +146 -0
- package/lib/jsdoc/template/publish.js +21 -2
- package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
- package/lib/scoping/get-all-tags.js +2 -9
- package/lib/scoping/missing-dependencies.js +65 -0
- package/lib/scoping/report-tags-usage.js +28 -0
- package/lib/scoping/scope-test-pages.js +2 -1
- package/lib/test-runner/test-runner.js +71 -0
- package/package.json +32 -29
- package/components-package/rollup-plugins/empty-module.js +0 -15
- package/components-package/rollup.js +0 -237
- 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 -40
- package/lib/documentation/templates/api-slots-section.js +0 -28
- package/lib/documentation/templates/template.js +0 -38
- 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/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 -31
- package/lib/postcss-new-files/index.js +0 -36
- 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,38 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
template: `
|
3
|
-
<div class="page-container">
|
4
|
-
<div class="api-container">
|
5
|
-
<section class="component-description">
|
6
|
-
{{{description}}}
|
7
|
-
<section class="component-api space-top">
|
8
|
-
{{> properties this}}
|
9
|
-
{{> slots this}}
|
10
|
-
{{> events this}}
|
11
|
-
{{> methods this}}
|
12
|
-
{{> cssVariables this}}
|
13
|
-
</section>
|
14
|
-
</section>
|
15
|
-
</div>
|
16
|
-
</div>
|
17
|
-
{{#each additionalDocs}}
|
18
|
-
<div class="api-container appended-doc">
|
19
|
-
<h1>{{this.basename}}</h1>
|
20
|
-
<section class="component-description">
|
21
|
-
{{{this.description}}}
|
22
|
-
<section class="component-api space-top">
|
23
|
-
{{> properties this}}
|
24
|
-
{{> slots this}}
|
25
|
-
{{> events this}}
|
26
|
-
{{> cssVariables this}}
|
27
|
-
</section>
|
28
|
-
</section>
|
29
|
-
</div>
|
30
|
-
{{/each}}
|
31
|
-
<footer class="footer-wrapper">
|
32
|
-
<div class="footer-links">
|
33
|
-
<a class="separator" href="https://www.sap.com/about/legal/privacy.html" target="_blank">Privacy Policy</a>
|
34
|
-
<a href="https://www.sap.com/about/legal/impressum.html" target="_blank">Legal</a>
|
35
|
-
</div>
|
36
|
-
<img src="../../../../../../assets/images/sap-logo-svg.svg" alt="Sap Logo" />
|
37
|
-
</footer>`
|
38
|
-
};
|
@@ -1,54 +0,0 @@
|
|
1
|
-
const esprima = require("esprima");
|
2
|
-
const escodegen = require("escodegen");
|
3
|
-
|
4
|
-
const fs = require("fs");
|
5
|
-
const path = require("path");
|
6
|
-
const glob = require("glob");
|
7
|
-
const basePath = process.argv[2];
|
8
|
-
|
9
|
-
const convertImports = (srcPath) => {
|
10
|
-
let changed = false;
|
11
|
-
// console.log("scanning imports of", srcPath);
|
12
|
-
let code = fs.readFileSync(srcPath).toString();
|
13
|
-
const tree = esprima.parseModule(code);
|
14
|
-
const importer = srcPath.replace(basePath, "");
|
15
|
-
const importerDir = path.dirname(importer);
|
16
|
-
// console.log("-> ", importer);
|
17
|
-
tree.body.forEach(node => {
|
18
|
-
if (node.type === "ImportDeclaration") {
|
19
|
-
let importee = node.source.value;
|
20
|
-
if (importee.startsWith(".")) {
|
21
|
-
// add .js extension if missing
|
22
|
-
if (!importee.endsWith(".js")) {
|
23
|
-
node.source.value += ".js"
|
24
|
-
changed = true;
|
25
|
-
}
|
26
|
-
return;
|
27
|
-
}
|
28
|
-
let importeeDir = path.dirname(importee);
|
29
|
-
let importeeFile = path.basename(importee);
|
30
|
-
let relativePath = path.relative(importerDir, importeeDir);
|
31
|
-
if (relativePath.length === 0) {
|
32
|
-
relativePath = "."
|
33
|
-
}
|
34
|
-
if (!relativePath.startsWith(".")) {
|
35
|
-
relativePath = "./" + relativePath;
|
36
|
-
}
|
37
|
-
|
38
|
-
relativePath = relativePath.replace(/\\/g, "/"); // the browser expects unix paths
|
39
|
-
let relativeImport = `${relativePath}/${importeeFile}.js`;
|
40
|
-
// console.log(importee + " --> " + relativeImport);
|
41
|
-
node.source.value = relativeImport;
|
42
|
-
changed = true;
|
43
|
-
}
|
44
|
-
});
|
45
|
-
|
46
|
-
if (changed) {
|
47
|
-
fs.writeFileSync(srcPath, escodegen.generate(tree));
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
const fileNames = glob.sync(basePath + "**/*.js");
|
52
|
-
// console.log(fileNames);
|
53
|
-
fileNames.forEach(convertImports);
|
54
|
-
console.log("Success: Converted absolute imports to relative for files in:", basePath)
|
package/lib/hash/config.js
DELETED
package/lib/hash/generate.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
const fs = require("fs");
|
2
|
-
const path = require("path");
|
3
|
-
const process = require("process");
|
4
|
-
const { hashElement } = require("folder-hash");
|
5
|
-
const config = require("./config.js");
|
6
|
-
|
7
|
-
const inputDir = path.normalize(process.argv[2]);
|
8
|
-
const outputFileName = path.normalize(process.argv[3]);
|
9
|
-
|
10
|
-
const generateHash = async (inputDir, outputFileName) => {
|
11
|
-
const result = await hashElement(inputDir, config);
|
12
|
-
const hash = result.hash;
|
13
|
-
fs.writeFileSync(outputFileName, hash);
|
14
|
-
return hash;
|
15
|
-
};
|
16
|
-
|
17
|
-
generateHash(inputDir, outputFileName).then(hash => {
|
18
|
-
console.log(`Generated hash: ${hash}`);
|
19
|
-
});
|
package/lib/hash/upToDate.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
const fs = require("fs");
|
2
|
-
const path = require("path");
|
3
|
-
const process = require("process");
|
4
|
-
const { hashElement } = require("folder-hash");
|
5
|
-
const config = require("./config.js");
|
6
|
-
|
7
|
-
const inputDir = path.normalize(process.argv[2]);
|
8
|
-
const hashFileName = path.normalize(process.argv[3]);
|
9
|
-
|
10
|
-
const isUpToDate = async (inputDir, hashFileName) => {
|
11
|
-
// No dist/ directory or no hash file
|
12
|
-
if (!fs.existsSync(inputDir) || !fs.existsSync(hashFileName)) {
|
13
|
-
return false;
|
14
|
-
}
|
15
|
-
|
16
|
-
// Empty hash file
|
17
|
-
const existingHash = `${fs.readFileSync(hashFileName)}`;
|
18
|
-
if (!existingHash) {
|
19
|
-
return false;
|
20
|
-
}
|
21
|
-
|
22
|
-
// Calculate the hash of the dist/ directory
|
23
|
-
const result = await hashElement(inputDir, config);
|
24
|
-
const newHash = result.hash;
|
25
|
-
|
26
|
-
return newHash === existingHash;
|
27
|
-
};
|
28
|
-
|
29
|
-
isUpToDate(inputDir, hashFileName).then(upToDate => {
|
30
|
-
process.exit(upToDate ? 0 : 1); // 0 means success (it is up to date), 1 means failure (must rebuild the dist/)
|
31
|
-
});
|
@@ -1,45 +0,0 @@
|
|
1
|
-
const fs = require('fs');
|
2
|
-
const path = require('path');
|
3
|
-
const mkdirp = require('mkdirp');
|
4
|
-
const assets = require("../../assets-meta.js");
|
5
|
-
|
6
|
-
const DEFAULT_THEME = assets.themes.default;
|
7
|
-
|
8
|
-
const getDefaultThemeCode = packageName => {
|
9
|
-
return `import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
|
10
|
-
|
11
|
-
import defaultThemeBase from "@ui5/webcomponents-theme-base/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
|
12
|
-
import defaultTheme from "./${DEFAULT_THEME}/parameters-bundle.css.js";
|
13
|
-
|
14
|
-
registerThemePropertiesLoader("@ui5/webcomponents-theme-base", "${DEFAULT_THEME}", () => defaultThemeBase);
|
15
|
-
registerThemePropertiesLoader("${packageName}", "${DEFAULT_THEME}", () => defaultTheme);
|
16
|
-
`;
|
17
|
-
};
|
18
|
-
|
19
|
-
const proccessCSS = css => {
|
20
|
-
css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
|
21
|
-
css = css.replace(/\.background-image.*{.*}/, "");
|
22
|
-
css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
|
23
|
-
css = css.replace(/--sapFontUrl.*\);?/, "");
|
24
|
-
return JSON.stringify(css);
|
25
|
-
}
|
26
|
-
|
27
|
-
module.exports = function (opts) {
|
28
|
-
opts = opts || {};
|
29
|
-
|
30
|
-
return {
|
31
|
-
postcssPlugin: 'postcss-css-to-esm',
|
32
|
-
Once (root) {
|
33
|
-
let css = root.toString();
|
34
|
-
css = proccessCSS(css);
|
35
|
-
|
36
|
-
const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/dist/generated/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\");
|
37
|
-
mkdirp.sync(path.dirname(targetFile));
|
38
|
-
|
39
|
-
const filePath = `${targetFile}.js`;
|
40
|
-
const defaultTheme = opts.includeDefaultTheme ? getDefaultThemeCode(opts.packageName) : ``;
|
41
|
-
fs.writeFileSync(filePath, `${defaultTheme}export default ${css};`);
|
42
|
-
}
|
43
|
-
};
|
44
|
-
};
|
45
|
-
module.exports.postcss = true;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
const fs = require('fs');
|
2
|
-
const path = require('path');
|
3
|
-
const mkdirp = require('mkdirp');
|
4
|
-
|
5
|
-
const proccessCSS = css => {
|
6
|
-
css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
|
7
|
-
css = css.replace(/\.background-image.*{.*}/, "");
|
8
|
-
css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
|
9
|
-
css = css.replace(/--sapFontUrl.*\);?/, "");
|
10
|
-
return css;
|
11
|
-
}
|
12
|
-
|
13
|
-
module.exports = function (opts) {
|
14
|
-
opts = opts || {};
|
15
|
-
|
16
|
-
return {
|
17
|
-
postcssPlugin: 'postcss-css-to-json',
|
18
|
-
Once (root) {
|
19
|
-
let css = root.toString();
|
20
|
-
css = proccessCSS(css);
|
21
|
-
|
22
|
-
const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/dist/generated/assets/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\assets\\");
|
23
|
-
mkdirp.sync(path.dirname(targetFile));
|
24
|
-
|
25
|
-
const filePath = `${targetFile}.json`;
|
26
|
-
fs.writeFileSync(filePath, JSON.stringify({_: css}));
|
27
|
-
}
|
28
|
-
};
|
29
|
-
};
|
30
|
-
|
31
|
-
module.exports.postcss = true;
|
@@ -1,36 +0,0 @@
|
|
1
|
-
const chokidar = require("chokidar");
|
2
|
-
const commandLineArgs = require("command-line-args");
|
3
|
-
const { exec } = require("child_process");
|
4
|
-
|
5
|
-
const options = commandLineArgs([
|
6
|
-
{ name: "srcFiles", type: String },
|
7
|
-
]);
|
8
|
-
|
9
|
-
const runPostcss = path => {
|
10
|
-
let command = `postcss ${path} --config config/postcss.components --base src --dir dist/css/`;
|
11
|
-
console.log(`Executing: ${command}`);
|
12
|
-
exec(command, (err, stdout, stderr) => {
|
13
|
-
if (err) {
|
14
|
-
console.log(`Could not run postcss for ${path}. Error: ${err}`);
|
15
|
-
}
|
16
|
-
});
|
17
|
-
|
18
|
-
command = `${command} -w`;
|
19
|
-
console.log(`Executing: ${command}`);
|
20
|
-
exec(command, (err, stdout, stderr) => {
|
21
|
-
if (err) {
|
22
|
-
console.log(`Could not run postcss in watch mode for ${path}. Error: ${err}`);
|
23
|
-
}
|
24
|
-
});
|
25
|
-
};
|
26
|
-
|
27
|
-
let ready = false; // Do nothing until the ready event has been fired (we don't want to recompile all files initially)
|
28
|
-
const watcher = chokidar.watch(options.srcFiles);
|
29
|
-
watcher.on("ready", () => {
|
30
|
-
ready = true; // Initial scan is over -> waiting for new files
|
31
|
-
});
|
32
|
-
watcher.on("add", path => {
|
33
|
-
if (ready) {
|
34
|
-
runPostcss(path);
|
35
|
-
}
|
36
|
-
});
|
@@ -1,20 +0,0 @@
|
|
1
|
-
const fs = require("fs");
|
2
|
-
const glob = require("glob");
|
3
|
-
|
4
|
-
const basePath = process.argv[2];
|
5
|
-
|
6
|
-
const replaceGlobalCoreUsage = (srcPath) => {
|
7
|
-
|
8
|
-
const original = fs.readFileSync(srcPath).toString();
|
9
|
-
let replaced = original.replace(/sap\.ui\.getCore\(\)/g, `Core`);
|
10
|
-
|
11
|
-
if (original !== replaced) {
|
12
|
-
replaced = `import Core from 'sap/ui/core/Core';
|
13
|
-
${replaced}`;
|
14
|
-
fs.writeFileSync(srcPath, replaced);
|
15
|
-
}
|
16
|
-
};
|
17
|
-
|
18
|
-
const fileNames = glob.sync(basePath + "**/*.js");
|
19
|
-
fileNames.forEach(replaceGlobalCoreUsage);
|
20
|
-
console.log("Success: Replaced global core usage in:", basePath);
|
package/lib/serve/index.js
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
const fs = require("fs");
|
2
|
-
const path = require("path");
|
3
|
-
const commandLineArgs = require("command-line-args");
|
4
|
-
const { exec } = require("child_process");
|
5
|
-
const colors = require("colors/safe");
|
6
|
-
const isPortReachable = require("is-port-reachable");
|
7
|
-
|
8
|
-
const options = commandLineArgs([
|
9
|
-
{ name: "port", type: Number },
|
10
|
-
{ name: "portStep", type: Number },
|
11
|
-
{ name: "packageName", type: String },
|
12
|
-
{ name: "dir", type: String },
|
13
|
-
{ name: "config", type: String },
|
14
|
-
]);
|
15
|
-
const serveConfig = path.join(__dirname, `serve.json`);
|
16
|
-
|
17
|
-
const requestPort = async () => {
|
18
|
-
const serveProcess = (await gen.next()).value;
|
19
|
-
serveProcess.stdout.on('data', data => {
|
20
|
-
const matches = data.match(/Accepting connections at .*?:(\d+)/);
|
21
|
-
if (matches) {
|
22
|
-
console.log(colors.yellow(`Reserved port ${matches[1]} for the ${options.packageName} package.`));
|
23
|
-
fs.writeFileSync(".port", matches[1]);
|
24
|
-
}
|
25
|
-
});
|
26
|
-
};
|
27
|
-
|
28
|
-
async function* serverGenerator(callback, port = 8080, step = 1) {
|
29
|
-
while (true) {
|
30
|
-
const portInUse = await isPortReachable(port, { host: "127.0.0.1" });
|
31
|
-
if (!portInUse) {
|
32
|
-
const command = `serve --config "${serveConfig}" --no-port-switching --no-clipboard -l ${port} ${options.dir}`;
|
33
|
-
console.log(colors.yellow(`Executing: ${command}`));
|
34
|
-
const serveProcess = exec(command, (err) => {
|
35
|
-
console.log(colors.yellow(`Port ${port} already in use.`));
|
36
|
-
callback();
|
37
|
-
});
|
38
|
-
yield serveProcess;
|
39
|
-
}
|
40
|
-
port += step;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
const gen = serverGenerator(requestPort, options.port, options.portStep);
|
45
|
-
|
46
|
-
requestPort();
|
package/lib/serve/serve.json
DELETED
package/package-lock.json
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "1.0.0-rc.8",
|
4
|
-
"lockfileVersion": 1,
|
5
|
-
"requires": true,
|
6
|
-
"dependencies": {
|
7
|
-
"balanced-match": {
|
8
|
-
"version": "1.0.0",
|
9
|
-
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
10
|
-
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
11
|
-
"dev": true
|
12
|
-
},
|
13
|
-
"brace-expansion": {
|
14
|
-
"version": "1.1.11",
|
15
|
-
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
16
|
-
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
17
|
-
"dev": true,
|
18
|
-
"requires": {
|
19
|
-
"balanced-match": "^1.0.0",
|
20
|
-
"concat-map": "0.0.1"
|
21
|
-
}
|
22
|
-
},
|
23
|
-
"concat-map": {
|
24
|
-
"version": "0.0.1",
|
25
|
-
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
26
|
-
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
27
|
-
"dev": true
|
28
|
-
},
|
29
|
-
"minimatch": {
|
30
|
-
"version": "3.0.4",
|
31
|
-
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
32
|
-
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
33
|
-
"dev": true,
|
34
|
-
"requires": {
|
35
|
-
"brace-expansion": "^1.1.7"
|
36
|
-
}
|
37
|
-
},
|
38
|
-
"recursive-readdir": {
|
39
|
-
"version": "2.2.2",
|
40
|
-
"resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz",
|
41
|
-
"integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==",
|
42
|
-
"dev": true,
|
43
|
-
"requires": {
|
44
|
-
"minimatch": "3.0.4"
|
45
|
-
}
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|