@blueprintui/cli 0.7.1 → 0.8.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 +6 -0
- package/README.md +2 -2
- package/package.json +16 -16
- package/src/index.mjs +1 -6
- package/src/plugin-minify-css.mjs +19 -94
- package/src/project/package.json +3 -3
- package/src/rollup.config.mjs +0 -6
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
20.
|
|
1
|
+
20.14.0
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Web Component libraries. This project is still an experimental work in progress.
|
|
|
17
17
|
|
|
18
18
|
| Options | Description |
|
|
19
19
|
| -------------- | ------------------------------------------ |
|
|
20
|
-
| --config
|
|
20
|
+
| --config | Path for `blueprint.config.js` file |
|
|
21
21
|
| --watch | Runs build in watch mode for development |
|
|
22
22
|
|
|
23
23
|
|
|
@@ -32,7 +32,7 @@ Web Component libraries. This project is still an experimental work in progress.
|
|
|
32
32
|
|
|
33
33
|
| Command | Description |
|
|
34
34
|
| ------------ | ----------------------------- |
|
|
35
|
-
| api | API lockfile management
|
|
35
|
+
| api | API lockfile management |
|
|
36
36
|
|
|
37
37
|
| Options | Description |
|
|
38
38
|
| -------------- | ----------------------------------------------------------------------------------------------- |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueprintui/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./index.mjs",
|
|
6
6
|
"bin": {
|
|
@@ -14,30 +14,30 @@
|
|
|
14
14
|
"author": "Crylan Software",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@custom-elements-manifest/analyzer": "0.
|
|
18
|
-
"@lit/ts-transformers": "2.0.
|
|
17
|
+
"@custom-elements-manifest/analyzer": "0.10.2",
|
|
18
|
+
"@lit/ts-transformers": "2.0.1",
|
|
19
19
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
20
|
-
"@rollup/plugin-replace": "5.0.
|
|
21
|
-
"@rollup/plugin-typescript": "11.1.
|
|
20
|
+
"@rollup/plugin-replace": "5.0.7",
|
|
21
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
22
22
|
"@rollup/plugin-virtual": "3.0.2",
|
|
23
23
|
"@skypack/package-check": "0.2.2",
|
|
24
|
-
"acorn-import-attributes": "1.9.
|
|
24
|
+
"acorn-import-attributes": "1.9.5",
|
|
25
25
|
"acorn-import-assertions": "1.9.0",
|
|
26
|
-
"browserslist": "4.
|
|
27
|
-
"commander": "
|
|
28
|
-
"glob": "10.
|
|
29
|
-
"lightningcss": "1.
|
|
26
|
+
"browserslist": "4.23.1",
|
|
27
|
+
"commander": "12.1.0",
|
|
28
|
+
"glob": "10.4.1",
|
|
29
|
+
"lightningcss": "1.25.1",
|
|
30
30
|
"minify-html-literals": "1.3.5",
|
|
31
31
|
"path": "0.12.7",
|
|
32
|
-
"rollup": "
|
|
32
|
+
"rollup": "4.18.0",
|
|
33
33
|
"rollup-plugin-copy": "3.5.0",
|
|
34
|
+
"rollup-plugin-css-modules": "0.1.2",
|
|
34
35
|
"rollup-plugin-delete": "2.0.0",
|
|
35
|
-
"rollup-plugin-import-css": "3.3.5",
|
|
36
36
|
"rollup-plugin-shell": "1.0.9",
|
|
37
|
-
"terser": "5.
|
|
38
|
-
"tslib": "2.6.
|
|
39
|
-
"typescript": "~5.
|
|
40
|
-
"zx": "
|
|
37
|
+
"terser": "5.31.1",
|
|
38
|
+
"tslib": "2.6.3",
|
|
39
|
+
"typescript": "~5.4.5",
|
|
40
|
+
"zx": "8.1.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"lite-server": "2.6.1"
|
package/src/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import * as url from 'url';
|
|
4
|
-
import { path } from 'zx';
|
|
4
|
+
import { path, spinner } from 'zx';
|
|
5
5
|
import { cwd } from 'process';
|
|
6
|
-
import { spinner } from 'zx/experimental';
|
|
7
6
|
import { rollup, watch } from 'rollup';
|
|
8
7
|
import { program } from 'commander';
|
|
9
8
|
import { loadConfigFile } from 'rollup/loadConfigFile';
|
|
@@ -118,10 +117,6 @@ function buildRollup(args) {
|
|
|
118
117
|
|
|
119
118
|
try {
|
|
120
119
|
watcher.on('event', (event) => {
|
|
121
|
-
if (event.result) {
|
|
122
|
-
event.result.watchFiles = null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
120
|
switch (event.code) {
|
|
126
121
|
case 'START':
|
|
127
122
|
console.log(status.info, 'Building...');
|
|
@@ -1,106 +1,31 @@
|
|
|
1
1
|
import browserslist from 'browserslist';
|
|
2
|
-
import { createFilter } from '@rollup/pluginutils';
|
|
3
2
|
import { transform, browserslistToTargets } from 'lightningcss';
|
|
4
|
-
import { path } from 'zx';
|
|
5
3
|
|
|
6
4
|
const targets = browserslistToTargets(browserslist('Chrome > 116'));
|
|
7
5
|
|
|
8
|
-
// fork of https://github.com/
|
|
6
|
+
// fork of https://github.com/justinfagnani/rollup-plugin-css-modules/tree/main
|
|
9
7
|
export const css = (options = {}) => {
|
|
10
|
-
const styles = {};
|
|
11
|
-
const filter = createFilter(
|
|
12
|
-
options.include ?? ['**/*.css'],
|
|
13
|
-
options.exclude ?? []
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
/* function to sort the css imports in order - credit to rollup-plugin-postcss */
|
|
17
|
-
const getRecursiveImportOrder = (id, getModuleInfo, seen = new Set()) => {
|
|
18
|
-
if (seen.has(id)) return [];
|
|
19
|
-
|
|
20
|
-
seen.add(id);
|
|
21
|
-
|
|
22
|
-
const result = [id];
|
|
23
|
-
|
|
24
|
-
getModuleInfo(id).importedIds.forEach((importFile) => {
|
|
25
|
-
result.push(...getRecursiveImportOrder(importFile, getModuleInfo, seen));
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return result;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
8
|
return {
|
|
32
|
-
name: '
|
|
33
|
-
|
|
34
|
-
/* convert the css file to a module and save the code for a file output */
|
|
9
|
+
name: 'css-modules',
|
|
35
10
|
transform(code, id) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (!styles[id] || styles[id] != output) {
|
|
53
|
-
styles[id] = output;
|
|
11
|
+
const isCssModule = this.getModuleInfo(id)?.attributes.type === 'css';
|
|
12
|
+
if (isCssModule) {
|
|
13
|
+
const output = options.minify
|
|
14
|
+
? transform({
|
|
15
|
+
targets,
|
|
16
|
+
drafts: {
|
|
17
|
+
nesting: true,
|
|
18
|
+
},
|
|
19
|
+
analyzeDependencies: true,
|
|
20
|
+
code: Buffer.from(code),
|
|
21
|
+
minify: true,
|
|
22
|
+
sourceMap: false,
|
|
23
|
+
}).code.toString()
|
|
24
|
+
: code;
|
|
25
|
+
|
|
26
|
+
return `const stylesheet = new CSSStyleSheet();stylesheet.replaceSync(\`${output}\`);export default stylesheet;`;
|
|
54
27
|
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
code: `const sheet = new CSSStyleSheet();sheet.replaceSync(${JSON.stringify(
|
|
58
|
-
output
|
|
59
|
-
)});export default sheet;`,
|
|
60
|
-
map: { mappings: '' },
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
/* output a css file with all css that was imported without being assigned a variable */
|
|
65
|
-
generateBundle(opts, bundle) {
|
|
66
|
-
/* collect all the imported modules for each entry file */
|
|
67
|
-
let modules = {};
|
|
68
|
-
let entryChunk = null;
|
|
69
|
-
for (let file in bundle) {
|
|
70
|
-
modules = Object.assign(modules, bundle[file].modules);
|
|
71
|
-
if (!entryChunk) entryChunk = bundle[file].facadeModuleId;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/* get the list of modules in order */
|
|
75
|
-
const moduleIds = getRecursiveImportOrder(entryChunk, this.getModuleInfo);
|
|
76
|
-
|
|
77
|
-
/* remove css that was imported as a string */
|
|
78
|
-
const css = Object.entries(styles)
|
|
79
|
-
.sort((a, b) => moduleIds.indexOf(a[0]) - moduleIds.indexOf(b[0]))
|
|
80
|
-
.map(([id, code]) => {
|
|
81
|
-
if (!modules[id]) return code;
|
|
82
|
-
})
|
|
83
|
-
.join('\n');
|
|
84
|
-
|
|
85
|
-
/* return the asset name by going through a set of possible options */
|
|
86
|
-
const getAssetName = () => {
|
|
87
|
-
const fileName = options.output ?? opts.file ?? 'bundle.js';
|
|
88
|
-
return `${path.basename(fileName, path.extname(fileName))}.css`;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/* return the asset fileName by going through a set of possible options */
|
|
92
|
-
const getAssetFileName = () => {
|
|
93
|
-
if (options.output) return options.output;
|
|
94
|
-
if (opts.assetFileNames) return undefined;
|
|
95
|
-
return `${getAssetName()}.css`;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
this.emitFile({
|
|
99
|
-
type: 'asset',
|
|
100
|
-
name: getAssetName(),
|
|
101
|
-
fileName: getAssetFileName(),
|
|
102
|
-
source: css,
|
|
103
|
-
});
|
|
28
|
+
return null;
|
|
104
29
|
},
|
|
105
30
|
};
|
|
106
31
|
};
|
package/src/project/package.json
CHANGED
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"url": "https://cli.blueprintui.dev"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"lit": "^
|
|
37
|
+
"lit": "^3.1.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@blueprintui/cli": "^0.1
|
|
41
|
-
"typescript": "~4.
|
|
40
|
+
"@blueprintui/cli": "^0.7.1",
|
|
41
|
+
"typescript": "~5.4.5"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/rollup.config.mjs
CHANGED
|
@@ -6,8 +6,6 @@ import copy from 'rollup-plugin-copy';
|
|
|
6
6
|
import del from 'rollup-plugin-delete';
|
|
7
7
|
import execute from 'rollup-plugin-shell';
|
|
8
8
|
import { fs, glob, path } from 'zx';
|
|
9
|
-
import { importAssertions } from 'acorn-import-assertions';
|
|
10
|
-
// import { importAttributes } from 'acorn-import-attributes'; // enable when TypeScript supports import attributes
|
|
11
9
|
import { idiomaticDecoratorsTransformer, constructorCleanupTransformer } from '@lit/ts-transformers';
|
|
12
10
|
import { fileURLToPath } from 'url';
|
|
13
11
|
import { css } from './plugin-minify-css.mjs';
|
|
@@ -48,10 +46,6 @@ export default [
|
|
|
48
46
|
sourcemap: project.sourcemap,
|
|
49
47
|
sourcemapExcludeSources: true
|
|
50
48
|
},
|
|
51
|
-
acornInjectPlugins: [
|
|
52
|
-
importAssertions
|
|
53
|
-
// importAttributes
|
|
54
|
-
],
|
|
55
49
|
plugins: [
|
|
56
50
|
project.prod ? cleanOutDir() : [],
|
|
57
51
|
css({ minify: project.prod }),
|