@ui5/webcomponents-tools 0.0.0-41ab6cd28 → 0.0.0-4237771ff
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 +332 -0
- package/README.md +2 -1
- package/assets-meta.js +16 -7
- package/components-package/eslint.js +1 -0
- package/components-package/nps.js +34 -29
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -36
- package/components-package/wdio.js +6 -2
- package/icons-collection/nps.js +6 -4
- package/lib/create-illustrations/index.js +14 -0
- package/lib/create-new-component/index.js +1 -1
- 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 +46 -0
- package/lib/{postcss-css-to-esm/index.js → css-processors/shared.mjs} +36 -50
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/esm-abs-to-rel/index.js +4 -1
- package/lib/generate-custom-elements-manifest/index.js +1 -1
- package/lib/generate-js-imports/illustrations.js +78 -64
- package/lib/generate-json-imports/i18n.js +10 -5
- package/lib/generate-json-imports/themes.js +10 -5
- package/lib/jsdoc/preprocess.js +1 -1
- package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
- package/lib/scoping/get-all-tags.js +1 -1
- package/lib/scoping/scope-test-pages.js +2 -1
- package/package.json +6 -10
- package/lib/postcss-css-to-json/index.js +0 -47
- package/lib/postcss-new-files/index.js +0 -36
- package/lib/postcss-p/postcss-p.mjs +0 -14
package/lib/jsdoc/preprocess.js
CHANGED
@@ -116,7 +116,7 @@ const processComponentFile = async (fileName) => {
|
|
116
116
|
const destFileName = fileName.replace(sourceDir, inputDir).replace(/\.ts$/, ".js");
|
117
117
|
let jsFileContent = `${await fs.readFile(destFileName)}`;
|
118
118
|
|
119
|
-
const classDefinitionRegExp = new RegExp(`let.*? = class`, "gm");
|
119
|
+
const classDefinitionRegExp = new RegExp(`(let.*? = class)|(^class.*?)`, "gm");
|
120
120
|
let classDefinitionMatch = jsFileContent.match(classDefinitionRegExp);
|
121
121
|
if (!classDefinitionMatch) {
|
122
122
|
return; // not a file, generated by typescript, nothing to do here
|
@@ -154,22 +154,29 @@ module.exports = (options) => {
|
|
154
154
|
options.removeDuplicatedProperties ||
|
155
155
|
options.removeDuplicatedValues
|
156
156
|
) {
|
157
|
-
removeDupProperties(
|
158
|
-
|
159
|
-
|
160
|
-
);
|
157
|
+
// removeDupProperties(
|
158
|
+
// destination,
|
159
|
+
// options.removeDuplicatedValues,
|
160
|
+
// );
|
161
161
|
}
|
162
162
|
} else {
|
163
163
|
if (
|
164
164
|
options.removeDuplicatedProperties ||
|
165
165
|
options.removeDuplicatedValues
|
166
166
|
) {
|
167
|
-
removeDupProperties(rule, options.removeDuplicatedValues);
|
167
|
+
// removeDupProperties(rule, options.removeDuplicatedValues);
|
168
168
|
}
|
169
169
|
// add new selector to symbol table
|
170
170
|
map.set(selector, rule);
|
171
171
|
}
|
172
172
|
},
|
173
|
+
OnceExit(root) {
|
174
|
+
root.nodes.forEach(node => {
|
175
|
+
if (node.type === "rule") {
|
176
|
+
removeDupProperties(node, options.removeDuplicatedValues);
|
177
|
+
}
|
178
|
+
})
|
179
|
+
}
|
173
180
|
};
|
174
181
|
},
|
175
182
|
};
|
@@ -10,7 +10,7 @@ const getTag = file => {
|
|
10
10
|
|
11
11
|
const getPackageTags = (packageDir) => {
|
12
12
|
const srcDir = path.join(packageDir, "src/");
|
13
|
-
return glob.sync(path.join(srcDir, "/**/*.
|
13
|
+
return glob.sync(path.join(srcDir, "/**/*.ts")).flatMap(file => {
|
14
14
|
const tag = getTag(file);
|
15
15
|
return [tag];
|
16
16
|
}).filter(item => !!item);
|
@@ -18,6 +18,7 @@ const replaceTagsHTML = content => {
|
|
18
18
|
|
19
19
|
// Replace tags in any content
|
20
20
|
const replaceTagsAny = content => {
|
21
|
+
console.log(tags.length);
|
21
22
|
tags.forEach(tag => {
|
22
23
|
content = content.replace(new RegExp(`(^|[^\-_A-Za-z0-9])(${tag})([^\-_A-Za-z0-9]|$)`, "g"), `$1$2-${suffix}$3`);
|
23
24
|
});
|
@@ -27,7 +28,7 @@ const replaceTagsAny = content => {
|
|
27
28
|
// Replace bundle names and HTML tag names in test pages
|
28
29
|
glob.sync(path.join(root, "/**/*.html")).forEach(file => {
|
29
30
|
let content = String(fs.readFileSync(file));
|
30
|
-
content = content.replace(
|
31
|
+
content = content.replace("%VITE_BUNDLE_PATH%", "%VITE_BUNDLE_PATH_SCOPED%");
|
31
32
|
content = replaceTagsHTML(content);
|
32
33
|
fs.writeFileSync(file, content);
|
33
34
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-4237771ff",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -21,10 +21,9 @@
|
|
21
21
|
"directory": "packages/tools"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@typescript-eslint/eslint-plugin": "^
|
25
|
-
"@typescript-eslint/parser": "^
|
24
|
+
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
25
|
+
"@typescript-eslint/parser": "^6.9.0",
|
26
26
|
"@wdio/cli": "^7.19.7",
|
27
|
-
"@wdio/devtools-service": "^7.19.7",
|
28
27
|
"@wdio/dot-reporter": "^7.19.7",
|
29
28
|
"@wdio/local-runner": "^7.19.7",
|
30
29
|
"@wdio/mocha-framework": "^7.19.7",
|
@@ -37,7 +36,6 @@
|
|
37
36
|
"command-line-args": "^5.1.1",
|
38
37
|
"concurrently": "^6.0.0",
|
39
38
|
"cross-env": "^7.0.3",
|
40
|
-
"cssnano": "^4.1.11",
|
41
39
|
"escodegen": "^2.0.0",
|
42
40
|
"eslint": "^7.22.0",
|
43
41
|
"eslint-config-airbnb-base": "^14.2.1",
|
@@ -52,11 +50,9 @@
|
|
52
50
|
"jsdoc": "^3.6.6",
|
53
51
|
"json-beautify": "^1.1.1",
|
54
52
|
"mkdirp": "^1.0.4",
|
55
|
-
"modify-selectors": "^2.0.0",
|
56
53
|
"nps": "^5.10.0",
|
57
54
|
"postcss": "^8.4.5",
|
58
55
|
"postcss-cli": "^9.1.0",
|
59
|
-
"postcss-import": "^14.0.2",
|
60
56
|
"postcss-selector-parser": "^6.0.10",
|
61
57
|
"prompts": "^2.4.2",
|
62
58
|
"properties-reader": "^2.2.0",
|
@@ -64,9 +60,8 @@
|
|
64
60
|
"resolve": "^1.20.0",
|
65
61
|
"rimraf": "^3.0.2",
|
66
62
|
"slash": "3.0.0",
|
67
|
-
"vite": "^
|
68
|
-
"wdio-chromedriver-service": "^7.3.2"
|
69
|
-
"zx": "^4.3.0"
|
63
|
+
"vite": "^4.4.9",
|
64
|
+
"wdio-chromedriver-service": "^7.3.2"
|
70
65
|
},
|
71
66
|
"peerDependencies": {
|
72
67
|
"chromedriver": "*",
|
@@ -78,6 +73,7 @@
|
|
78
73
|
}
|
79
74
|
},
|
80
75
|
"devDependencies": {
|
76
|
+
"esbuild": "^0.19.9",
|
81
77
|
"yargs": "^17.5.1"
|
82
78
|
}
|
83
79
|
}
|
@@ -1,47 +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
|
-
const data = {
|
27
|
-
packageName: opts.packageName,
|
28
|
-
fileName: targetFile.substr(targetFile.lastIndexOf("themes")),
|
29
|
-
content: css
|
30
|
-
};
|
31
|
-
// it seems slower to read the old content, but writing the same content with no real changes
|
32
|
-
// (as in initial build and then watch mode) will cause an unnecessary dev server refresh
|
33
|
-
let oldContent = "";
|
34
|
-
try {
|
35
|
-
oldContent = fs.readFileSync(filePath).toString();
|
36
|
-
} catch (e) {
|
37
|
-
// file not found
|
38
|
-
}
|
39
|
-
const content = JSON.stringify({_: data});
|
40
|
-
if (content !== oldContent) {
|
41
|
-
fs.writeFileSync(filePath, content);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
};
|
45
|
-
};
|
46
|
-
|
47
|
-
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,14 +0,0 @@
|
|
1
|
-
import 'zx/globals';
|
2
|
-
|
3
|
-
// don't print executed commands and their output
|
4
|
-
$.verbose = false;
|
5
|
-
|
6
|
-
const inputFiles = await globby("src/**/parameters-bundle.css");
|
7
|
-
|
8
|
-
const restArgs = process.argv.slice(2);
|
9
|
-
|
10
|
-
// run all postcss processes in parallel as passing the glob directly to postcss makes them processed sequentially.
|
11
|
-
// and the amount of imports give a big speed up when run in parallel
|
12
|
-
await Promise.all(inputFiles.map(file => {
|
13
|
-
return $`postcss ${file} --config config/postcss.themes --base src --dir dist/css/ ${restArgs}`;
|
14
|
-
}));
|