@ui5/webcomponents-tools 0.0.0-7d5f73b20 → 0.0.0-7d8c57f70
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 +720 -0
- package/README.md +2 -1
- package/assets-meta.js +15 -7
- package/components-package/eslint.js +36 -28
- package/components-package/nps.js +54 -35
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -26
- package/components-package/vite.config.js +6 -5
- package/components-package/wdio.js +405 -393
- package/components-package/wdio.sync.js +9 -1
- package/icons-collection/nps.js +11 -7
- 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/create-icons/index.js +33 -10
- package/lib/create-illustrations/index.js +51 -30
- 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/virtual-index-html-plugin.js +1 -2
- package/lib/generate-custom-elements-manifest/index.js +51 -107
- 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/hbs2lit/src/compiler.js +9 -6
- package/lib/hbs2lit/src/litVisitor2.js +42 -17
- package/lib/hbs2lit/src/svgProcessor.js +12 -5
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +32 -4
- package/lib/hbs2ui5/index.js +21 -4
- package/lib/i18n/defaults.js +9 -3
- package/lib/i18n/toJSON.js +1 -1
- package/lib/jsdoc/preprocess.js +3 -3
- 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/lib/test-runner/test-runner.js +10 -2
- package/package.json +19 -10
- package/lib/esm-abs-to-rel/index.js +0 -58
- package/lib/postcss-css-to-esm/index.js +0 -63
- 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/replace-global-core/index.js +0 -25
package/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|

|
2
2
|
|
3
|
+
|
3
4
|
# UI5 Web Components - Tools
|
4
5
|
|
5
6
|
[](https://www.npmjs.com/package/@ui5/webcomponents)
|
@@ -13,7 +14,7 @@ used by other UI5 Web Components packages, such as `main` and `fiori`.
|
|
13
14
|
- [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
|
14
15
|
|
15
16
|
## Support
|
16
|
-
We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://
|
17
|
+
We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://ui5-slack-invite.cfapps.eu10.hana.ondemand.com/).
|
17
18
|
|
18
19
|
## Contribute
|
19
20
|
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
|
package/assets-meta.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
const assetsMeta = {
|
2
2
|
"themes": {
|
3
|
-
"default": "
|
3
|
+
"default": "sap_horizon",
|
4
4
|
"all": [
|
5
5
|
"sap_fiori_3",
|
6
6
|
"sap_fiori_3_dark",
|
@@ -9,12 +9,15 @@ const assetsMeta = {
|
|
9
9
|
"sap_belize_hcw",
|
10
10
|
"sap_fiori_3_hcb",
|
11
11
|
"sap_fiori_3_hcw",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
"sap_horizon",
|
13
|
+
"sap_horizon_dark",
|
14
|
+
"sap_horizon_hcb",
|
15
|
+
"sap_horizon_hcw",
|
16
|
+
"sap_horizon_exp",
|
17
|
+
"sap_horizon_dark_exp",
|
18
|
+
"sap_horizon_hcb_exp",
|
19
|
+
"sap_horizon_hcw_exp",
|
20
|
+
],
|
18
21
|
},
|
19
22
|
"languages": {
|
20
23
|
"default": "en",
|
@@ -22,6 +25,7 @@ const assetsMeta = {
|
|
22
25
|
"ar",
|
23
26
|
"bg",
|
24
27
|
"ca",
|
28
|
+
"cnr",
|
25
29
|
"cs",
|
26
30
|
"cy",
|
27
31
|
"da",
|
@@ -49,6 +53,7 @@ const assetsMeta = {
|
|
49
53
|
"ko",
|
50
54
|
"lt",
|
51
55
|
"lv",
|
56
|
+
"mk",
|
52
57
|
"ms",
|
53
58
|
"nl",
|
54
59
|
"no",
|
@@ -60,6 +65,7 @@ const assetsMeta = {
|
|
60
65
|
"sh",
|
61
66
|
"sk",
|
62
67
|
"sl",
|
68
|
+
"sr",
|
63
69
|
"sv",
|
64
70
|
"th",
|
65
71
|
"tr",
|
@@ -77,6 +83,7 @@ const assetsMeta = {
|
|
77
83
|
"ar_SA",
|
78
84
|
"bg",
|
79
85
|
"ca",
|
86
|
+
"cnr",
|
80
87
|
"cs",
|
81
88
|
"da",
|
82
89
|
"de",
|
@@ -124,6 +131,7 @@ const assetsMeta = {
|
|
124
131
|
"lt",
|
125
132
|
"lv",
|
126
133
|
"ms",
|
134
|
+
"mk",
|
127
135
|
"nb",
|
128
136
|
"nl",
|
129
137
|
"nl_BE",
|
@@ -1,3 +1,38 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const path = require("path");
|
3
|
+
const tsMode = fs.existsSync(path.join(process.cwd(), "tsconfig.json"));
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Typescript Rules
|
7
|
+
*/
|
8
|
+
const overrides = tsMode ? [{
|
9
|
+
files: ["*.ts"],
|
10
|
+
parser: "@typescript-eslint/parser",
|
11
|
+
plugins: ["@typescript-eslint"],
|
12
|
+
extends: [
|
13
|
+
"plugin:@typescript-eslint/recommended",
|
14
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
15
|
+
],
|
16
|
+
parserOptions: {
|
17
|
+
"project": ["./tsconfig.json", "./packages/*/tsconfig.json"],
|
18
|
+
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
19
|
+
},
|
20
|
+
rules: {
|
21
|
+
"no-shadow": "off",
|
22
|
+
"@typescript-eslint/no-shadow": ["error"],
|
23
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
24
|
+
"@typescript-eslint/no-floating-promises": "off",
|
25
|
+
"@typescript-eslint/no-explicit-any": "off",
|
26
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
27
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
28
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
29
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
30
|
+
"@typescript-eslint/no-empty-function": "off",
|
31
|
+
"@typescript-eslint/no-empty-interface": "off",
|
32
|
+
"lines-between-class-members": "off",
|
33
|
+
}
|
34
|
+
}] : [];
|
35
|
+
|
1
36
|
module.exports = {
|
2
37
|
"env": {
|
3
38
|
"browser": true,
|
@@ -5,34 +40,7 @@ module.exports = {
|
|
5
40
|
},
|
6
41
|
"root": true,
|
7
42
|
"extends": "airbnb-base",
|
8
|
-
overrides
|
9
|
-
files: ["*.ts"],
|
10
|
-
parser: "@typescript-eslint/parser",
|
11
|
-
plugins: ["@typescript-eslint"],
|
12
|
-
extends: [
|
13
|
-
"plugin:@typescript-eslint/recommended",
|
14
|
-
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
15
|
-
],
|
16
|
-
parserOptions: {
|
17
|
-
"project": ["./tsconfig.json", "./packages/*/tsconfig.json"],
|
18
|
-
},
|
19
|
-
/**
|
20
|
-
* Typescript Rules
|
21
|
-
*/
|
22
|
-
rules: {
|
23
|
-
"no-shadow": "off",
|
24
|
-
"@typescript-eslint/no-shadow": ["error"],
|
25
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
26
|
-
"@typescript-eslint/no-floating-promises": "off",
|
27
|
-
"@typescript-eslint/no-explicit-any": "off",
|
28
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
29
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
30
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
31
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
32
|
-
"@typescript-eslint/no-empty-function": "off",
|
33
|
-
"lines-between-class-members": "off",
|
34
|
-
}
|
35
|
-
}],
|
43
|
+
overrides,
|
36
44
|
"parserOptions": {
|
37
45
|
"ecmaVersion": 2018,
|
38
46
|
"sourceType": "module"
|
@@ -8,14 +8,29 @@ const getScripts = (options) => {
|
|
8
8
|
|
9
9
|
// The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
|
10
10
|
const illustrationsData = options.illustrationsData || [];
|
11
|
-
illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
|
11
|
+
const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
|
12
12
|
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
13
13
|
|
14
|
-
// The script creates the "
|
15
|
-
|
16
|
-
|
17
|
-
const
|
18
|
-
const
|
14
|
+
// The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
|
15
|
+
const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.set} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.filterOut.join(" ")}`).join(" && ");
|
16
|
+
|
17
|
+
const tsOption = options.typescript;
|
18
|
+
const tsCommandOld = tsOption ? "tsc" : "";
|
19
|
+
let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
|
20
|
+
// this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
|
21
|
+
if (options.noWatchTS) {
|
22
|
+
tsWatchCommandStandalone = "";
|
23
|
+
}
|
24
|
+
const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
|
25
|
+
|
26
|
+
if (tsOption) {
|
27
|
+
try {
|
28
|
+
require("typescript");
|
29
|
+
} catch(e) {
|
30
|
+
console.error(`TypeScript is not found. Try to install it by running \`npm install --save-dev typescript\` if you are using npm or by running \`yarn add --dev typescript\` if you are using yarn.`);
|
31
|
+
process.exit(e.code);
|
32
|
+
}
|
33
|
+
}
|
19
34
|
|
20
35
|
let viteConfig;
|
21
36
|
if (fs.existsSync("config/vite.config.js")) {
|
@@ -30,10 +45,7 @@ const getScripts = (options) => {
|
|
30
45
|
}
|
31
46
|
|
32
47
|
let eslintConfig;
|
33
|
-
if (fs.existsSync("
|
34
|
-
// old project setup where config file is in separate folder
|
35
|
-
eslintConfig = "--config config/.eslintrc.js";
|
36
|
-
} else if (fs.existsSync(".eslintrc.js")) {
|
48
|
+
if (fs.existsSync(".eslintrc.js") || fs.existsSync(".eslintrc.cjs")) {
|
37
49
|
// preferred way of custom configuration in root project folder
|
38
50
|
eslintConfig = "";
|
39
51
|
} else {
|
@@ -44,20 +56,26 @@ const getScripts = (options) => {
|
|
44
56
|
const scripts = {
|
45
57
|
clean: 'rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
|
46
58
|
lint: `eslint . ${eslintConfig}`,
|
47
|
-
lintfix: `eslint . ${eslintConfig}`,
|
48
|
-
|
49
|
-
default:
|
59
|
+
lintfix: `eslint . ${eslintConfig} --fix`,
|
60
|
+
generate: {
|
61
|
+
default: `${tsCrossEnv} nps prepare.all`,
|
50
62
|
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
|
51
63
|
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
52
64
|
},
|
53
|
-
|
65
|
+
prepare: {
|
66
|
+
default: `${tsCrossEnv} nps clean prepare.all copy prepare.typescript generateAPI`,
|
67
|
+
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
|
68
|
+
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
69
|
+
typescript: tsCommandOld,
|
70
|
+
},
|
54
71
|
build: {
|
55
|
-
default: "nps prepare lint build.bundle",
|
56
|
-
templates: `mkdirp
|
72
|
+
default: "nps prepare lint build.bundle", // build.bundle2
|
73
|
+
templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
|
57
74
|
styles: {
|
58
|
-
default: "nps build.styles.themes build.styles.components"
|
59
|
-
themes: `node "${LIB}/
|
60
|
-
components: "
|
75
|
+
default: `concurrently "nps build.styles.themes" "nps build.styles.components" "nps build.styles.componentStyles"`,
|
76
|
+
themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
|
77
|
+
components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
|
78
|
+
componentStyles: `node "${LIB}/css-processors/css-processor-component-styles.mjs"`,
|
61
79
|
},
|
62
80
|
i18n: {
|
63
81
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
@@ -65,37 +83,36 @@ const getScripts = (options) => {
|
|
65
83
|
json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
|
66
84
|
},
|
67
85
|
jsonImports: {
|
68
|
-
default: "mkdirp
|
69
|
-
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes
|
70
|
-
i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n
|
86
|
+
default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
|
87
|
+
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes src/generated/json-imports`,
|
88
|
+
i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n src/generated/json-imports`,
|
71
89
|
},
|
72
90
|
jsImports: {
|
73
|
-
default: "mkdirp
|
91
|
+
default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
|
74
92
|
illustrationsLoaders: createIllustrationsLoadersScript,
|
75
93
|
},
|
76
94
|
bundle: `vite build ${viteConfig}`,
|
95
|
+
bundle2: ``,
|
77
96
|
illustrations: createIllustrationsJSImportsScript,
|
78
97
|
},
|
79
98
|
copy: {
|
80
99
|
default: "nps copy.src copy.props",
|
81
|
-
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
100
|
+
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
|
101
|
+
// srcGenerated2: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.{js,json}" dist/generated/`,
|
82
102
|
props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
|
83
103
|
},
|
84
104
|
watch: {
|
85
|
-
default:
|
105
|
+
default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" "nps watch.api" "nps watch.src" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
|
86
106
|
devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
|
87
107
|
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
|
88
|
-
typescript:
|
108
|
+
typescript: tsWatchCommandStandalone,
|
89
109
|
props: 'nps "copy.props --watch --safe --skip-initial-copy"',
|
90
110
|
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
91
111
|
styles: {
|
92
|
-
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
|
112
|
+
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components" "nps watch.styles.componentStyles" ',
|
93
113
|
themes: 'nps "build.styles.themes -w"',
|
94
|
-
components:
|
95
|
-
|
96
|
-
existingFiles: `nps "build.styles.components -w"`,
|
97
|
-
newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
|
98
|
-
},
|
114
|
+
components: `nps "build.styles.components -w"`,
|
115
|
+
componentStyles: `nps "build.styles.componentStyles -w"`,
|
99
116
|
},
|
100
117
|
templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
|
101
118
|
api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
|
@@ -107,7 +124,7 @@ const getScripts = (options) => {
|
|
107
124
|
"test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
|
108
125
|
startWithScope: "nps scope.prepare scope.watchWithBundle",
|
109
126
|
scope: {
|
110
|
-
prepare: "nps scope.lint
|
127
|
+
prepare: "nps scope.lint scope.testPages",
|
111
128
|
lint: `node "${LIB}/scoping/lint-src.js"`,
|
112
129
|
testPages: {
|
113
130
|
default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
|
@@ -120,11 +137,13 @@ const getScripts = (options) => {
|
|
120
137
|
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
121
138
|
},
|
122
139
|
generateAPI: {
|
123
|
-
default:
|
140
|
+
default: `nps ${ tsOption ? "generateAPI.generateCEM generateAPI.validateCEM" : "generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest generateAPI.validateCEM"}`,
|
141
|
+
generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.dev ? "--dev" : "" }`,
|
142
|
+
validateCEM: `node "${LIB}/cem/validate.js" ${ options.dev ? "--dev" : "" }`,
|
124
143
|
prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
|
125
144
|
prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
|
126
145
|
preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
|
127
|
-
jsdoc: `jsdoc -c "${LIB}/jsdoc/
|
146
|
+
jsdoc: `jsdoc -c "${LIB}/jsdoc/config.json"`,
|
128
147
|
cleanup: "rimraf jsdoc-dist/"
|
129
148
|
},
|
130
149
|
};
|
@@ -1,21 +1 @@
|
|
1
|
-
|
2
|
-
const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
|
3
|
-
const cssnano = require('cssnano');
|
4
|
-
const fs = require("fs");
|
5
|
-
|
6
|
-
const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
|
7
|
-
|
8
|
-
module.exports = {
|
9
|
-
plugins: [
|
10
|
-
postcssImport(),
|
11
|
-
cssnano({
|
12
|
-
preset: [
|
13
|
-
'default', {
|
14
|
-
mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
|
15
|
-
mergeRules: false, // https://github.com/cssnano/cssnano/issues/730
|
16
|
-
},
|
17
|
-
]
|
18
|
-
}),
|
19
|
-
postcssCSStoESM({toReplace: 'src', includeDefaultTheme: true, packageName}),
|
20
|
-
]
|
21
|
-
};
|
1
|
+
module.exports = {}
|
@@ -1,26 +1 @@
|
|
1
|
-
|
2
|
-
const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
|
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 = {};
|
@@ -1,12 +1,13 @@
|
|
1
1
|
// vite.config.js
|
2
|
-
|
3
|
-
|
2
|
+
import { defineConfig } from 'vite';
|
3
|
+
import virtualIndex from '../lib/dev-server/virtual-index-html-plugin.js';
|
4
4
|
|
5
|
-
|
5
|
+
export default defineConfig(async () => {
|
6
|
+
const data = await virtualIndex();
|
6
7
|
return {
|
7
8
|
build: {
|
8
9
|
emptyOutDir: false,
|
9
10
|
},
|
10
|
-
plugins: [
|
11
|
+
plugins: [data],
|
11
12
|
}
|
12
|
-
})
|
13
|
+
})
|