@blueprintui/cli 0.1.3 → 0.2.0
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/.nvmrc +1 -1
- package/CHANGELOG.md +8 -0
- package/package.json +14 -12
- package/src/plugin-minify-css.mjs +29 -0
- package/src/rollup.config.mjs +5 -23
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
20.0.0
|
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueprintui/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./index.mjs",
|
|
6
6
|
"bin": {
|
|
@@ -14,29 +14,31 @@
|
|
|
14
14
|
"author": "Crylan Software",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@custom-elements-manifest/analyzer": "0.
|
|
17
|
+
"@custom-elements-manifest/analyzer": "0.8.1",
|
|
18
18
|
"@lit/ts-transformers": "1.1.3",
|
|
19
|
-
"@rollup/plugin-node-resolve": "15.0.
|
|
19
|
+
"@rollup/plugin-node-resolve": "15.0.2",
|
|
20
20
|
"@rollup/plugin-replace": "5.0.2",
|
|
21
|
-
"@rollup/plugin-typescript": "11.
|
|
21
|
+
"@rollup/plugin-typescript": "11.1.0",
|
|
22
22
|
"@rollup/plugin-virtual": "3.0.1",
|
|
23
23
|
"@skypack/package-check": "0.2.2",
|
|
24
24
|
"acorn-import-assertions": "1.8.0",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"browserslist": "4.21.5",
|
|
26
|
+
"commander": "10.0.1",
|
|
27
|
+
"lightningcss": "1.20.0",
|
|
28
|
+
"glob": "10.2.2",
|
|
28
29
|
"minify-html-literals": "1.3.5",
|
|
29
30
|
"path": "0.12.7",
|
|
30
|
-
"rollup": "3.
|
|
31
|
+
"rollup": "3.21.5",
|
|
31
32
|
"rollup-plugin-copy": "3.4.0",
|
|
32
33
|
"rollup-plugin-delete": "2.0.0",
|
|
34
|
+
"rollup-plugin-import-assert": "3.0.1",
|
|
33
35
|
"rollup-plugin-shell": "1.0.9",
|
|
34
|
-
"terser": "5.
|
|
36
|
+
"terser": "5.17.1",
|
|
35
37
|
"tslib": "2.5.0",
|
|
36
|
-
"typescript": "
|
|
37
|
-
"zx": "7.2.
|
|
38
|
+
"typescript": "~4.7.4",
|
|
39
|
+
"zx": "7.2.2"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
|
-
"lite-server": "
|
|
42
|
+
"lite-server": "2.6.1"
|
|
41
43
|
}
|
|
42
44
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import browserslist from 'browserslist';
|
|
2
|
+
import { transform, browserslistToTargets } from 'lightningcss';
|
|
3
|
+
import { path } from 'zx';
|
|
4
|
+
|
|
5
|
+
const targets = browserslistToTargets(browserslist('Chrome > 112'));
|
|
6
|
+
|
|
7
|
+
export function minifyCSS() {
|
|
8
|
+
return {
|
|
9
|
+
load(id) { return id.slice(-4) === '.css' ? this.addWatchFile(path.resolve(id)) : null },
|
|
10
|
+
transform: async (css, id) => {
|
|
11
|
+
if (id.slice(-4) === '.css') {
|
|
12
|
+
const code = transform({
|
|
13
|
+
targets,
|
|
14
|
+
drafts: {
|
|
15
|
+
nesting: true
|
|
16
|
+
},
|
|
17
|
+
analyzeDependencies: true,
|
|
18
|
+
code: Buffer.from(css),
|
|
19
|
+
minify: true,
|
|
20
|
+
sourceMap: false
|
|
21
|
+
}).code.toString()
|
|
22
|
+
|
|
23
|
+
return { code, map: { mappings: '' } };
|
|
24
|
+
} else {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
package/src/rollup.config.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as csso from 'csso';
|
|
2
1
|
import typescript from '@rollup/plugin-typescript';
|
|
3
2
|
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
4
3
|
import replace from '@rollup/plugin-replace';
|
|
@@ -10,8 +9,9 @@ import { fs, glob, path } from 'zx';
|
|
|
10
9
|
import { importAssertions } from 'acorn-import-assertions';
|
|
11
10
|
import { idiomaticDecoratorsTransformer, constructorCleanupTransformer } from '@lit/ts-transformers';
|
|
12
11
|
import { fileURLToPath } from 'url';
|
|
13
|
-
import { minifyHTML } from './plugin-minify-html-literals.mjs';
|
|
14
12
|
import { importAssertionsPlugin } from './plugin-import-assert.mjs';
|
|
13
|
+
import { minifyCSS } from './plugin-minify-css.mjs';
|
|
14
|
+
import { minifyHTML } from './plugin-minify-html-literals.mjs';
|
|
15
15
|
import { minifyJavaScript } from './plugin-minify-javascript.mjs';
|
|
16
16
|
import { customElementsAnalyzer } from './plugin-custom-elements-analyzer.mjs';
|
|
17
17
|
import { writeCache } from './plugin-esm-cache.mjs';
|
|
@@ -33,7 +33,7 @@ const project = {
|
|
|
33
33
|
customElementsManifestConfig: config.customElementsManifestConfig ? path.resolve(cwd, config.customElementsManifestConfig) : path.resolve(__dirname, './custom-elements-manifest.config.mjs'),
|
|
34
34
|
prod: process.env.BLUEPRINTUI_BUILD === 'production',
|
|
35
35
|
sourcemap: config.sourcemap
|
|
36
|
-
}
|
|
36
|
+
};
|
|
37
37
|
|
|
38
38
|
export default [
|
|
39
39
|
{
|
|
@@ -52,17 +52,16 @@ export default [
|
|
|
52
52
|
plugins: [
|
|
53
53
|
project.prod ? cleanOutDir() : [],
|
|
54
54
|
copyAssets(),
|
|
55
|
-
project.prod ?
|
|
55
|
+
project.prod ? minifyCSS() : [],
|
|
56
56
|
importAssertionsPlugin(),
|
|
57
57
|
createEntrypoints(),
|
|
58
58
|
nodeResolve({ exportConditions: [project.prod ? 'production' : 'development'] }),
|
|
59
59
|
compileTypescript(),
|
|
60
|
-
|
|
60
|
+
typeCheck(),
|
|
61
61
|
project.prod ? [] : writeCache(project),
|
|
62
62
|
project.prod ? minifyHTML() : [],
|
|
63
63
|
project.prod ? minifyJavaScript() : [],
|
|
64
64
|
project.prod ? inlinePackageVersion() : [],
|
|
65
|
-
project.prod ? patchSuperMinify() : [],
|
|
66
65
|
project.prod ? postClean(): [],
|
|
67
66
|
project.prod ? packageCheck() : [],
|
|
68
67
|
project.prod ? customElementsAnalyzer(project) : [],
|
|
@@ -104,16 +103,6 @@ function inlinePackageVersion() {
|
|
|
104
103
|
return replace({ preventAssignment: false, values: { PACKAGE_VERSION: project.packageJSON.version } });
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
function patchSuperMinify() {
|
|
108
|
-
return replace({
|
|
109
|
-
preventAssignment: false,
|
|
110
|
-
values: {
|
|
111
|
-
'super(...arguments),': 'super(...arguments);',
|
|
112
|
-
'super(),': 'super();',
|
|
113
|
-
}, // safari 15 and latest chromium pupeteer bug with minification optimization in terser
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
106
|
function postClean() {
|
|
118
107
|
return del({ targets: [`${project.outDir}/**/.tsbuildinfo`, `${project.outDir}/**/_virtual`], hook: 'writeBundle' });
|
|
119
108
|
}
|
|
@@ -130,10 +119,3 @@ function cleanPackageJson() {
|
|
|
130
119
|
}
|
|
131
120
|
}
|
|
132
121
|
}
|
|
133
|
-
|
|
134
|
-
function cssOptimize() {
|
|
135
|
-
return {
|
|
136
|
-
load(id) { return id.slice(-4) === '.css' ? this.addWatchFile(path.resolve(id)) : null },
|
|
137
|
-
transform: async (css, id) => id.slice(-4) === '.css' ? ({ code: csso.minify(css, { comments: false }).css, map: { mappings: '' } }) : null
|
|
138
|
-
};
|
|
139
|
-
};
|