@plumeria/compiler 0.8.6 → 0.8.9
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/bin/{css.mjs → css.js} +5 -5
- package/dist/index.js +24 -17
- package/package.json +4 -4
package/bin/{css.mjs → css.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
const { styleText } = require('util');
|
|
7
7
|
|
|
8
8
|
try {
|
|
9
9
|
const checkMark = styleText('greenBright', '✓');
|
|
@@ -24,7 +24,7 @@ try {
|
|
|
24
24
|
const a2 = process.argv.includes('--paths') ? '--paths' : '';
|
|
25
25
|
const argv = [a1, a2].join(' ');
|
|
26
26
|
|
|
27
|
-
execSync(`node
|
|
27
|
+
execSync(`node -r rscute compiler/dist/index.js ` + argv, {
|
|
28
28
|
stdio: 'inherit',
|
|
29
29
|
cwd: plumeriaPath,
|
|
30
30
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { unlinkSync, existsSync, readFileSync } = require('fs');
|
|
4
|
+
const { readFile, writeFile } = require('fs/promises');
|
|
5
|
+
const fg = require('fast-glob');
|
|
6
|
+
const postcss = require('postcss');
|
|
7
|
+
const combineSelectors = require('postcss-combine-duplicated-selectors');
|
|
8
|
+
const { execute } = require('rscute/execute');
|
|
9
|
+
const { transform } = require('lightningcss');
|
|
10
|
+
const { parseSync } = require('@swc/core');
|
|
11
|
+
const { buildGlobal, buildCreate } = require('@plumeria/core/build-helper');
|
|
10
12
|
const projectRoot = process.cwd().split('node_modules')[0];
|
|
11
13
|
const directPath = path.join(projectRoot, 'node_modules/@plumeria/core');
|
|
12
14
|
const coreFilePath = path.join(directPath, 'stylesheet/core.css');
|
|
@@ -22,8 +24,8 @@ const cleanUp = async () => {
|
|
|
22
24
|
console.error('An error occurred:', err);
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
|
-
|
|
26
|
-
const code =
|
|
27
|
+
function isCSS(filePath) {
|
|
28
|
+
const code = readFileSync(filePath, 'utf8');
|
|
27
29
|
const ast = parseSync(code, {
|
|
28
30
|
syntax: 'typescript',
|
|
29
31
|
tsx: filePath.endsWith('.tsx'),
|
|
@@ -44,7 +46,9 @@ async function isCSS(filePath) {
|
|
|
44
46
|
const value = node[key];
|
|
45
47
|
if (value && typeof value === 'object') {
|
|
46
48
|
if (Array.isArray(value)) {
|
|
47
|
-
value
|
|
49
|
+
for (const item of value) {
|
|
50
|
+
visit(item);
|
|
51
|
+
}
|
|
48
52
|
}
|
|
49
53
|
else {
|
|
50
54
|
visit(value);
|
|
@@ -87,12 +91,16 @@ async function getAppRoot() {
|
|
|
87
91
|
await cleanUp();
|
|
88
92
|
const appRoot = await getAppRoot();
|
|
89
93
|
const files = await fg([path.join(appRoot, '**/*.{js,jsx,ts,tsx}')], {
|
|
90
|
-
ignore: [
|
|
94
|
+
ignore: [
|
|
95
|
+
'**/node_modules/**',
|
|
96
|
+
'**/dist/**',
|
|
97
|
+
'**/build/**',
|
|
98
|
+
'**/.next/**',
|
|
99
|
+
],
|
|
91
100
|
});
|
|
92
|
-
const
|
|
93
|
-
const styleFiles = files.filter((_, i) => results[i]);
|
|
101
|
+
const styleFiles = files.filter(isCSS).sort();
|
|
94
102
|
for (let i = 0; i < styleFiles.length; i++) {
|
|
95
|
-
await
|
|
103
|
+
await execute(path.resolve(styleFiles[i]));
|
|
96
104
|
if (process.argv.includes('--paths'))
|
|
97
105
|
console.log(styleFiles[i]);
|
|
98
106
|
}
|
|
@@ -101,7 +109,6 @@ async function getAppRoot() {
|
|
|
101
109
|
}
|
|
102
110
|
for (let i = 0; i < styleFiles.length; i++) {
|
|
103
111
|
await buildCreate(coreFilePath);
|
|
104
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
105
112
|
}
|
|
106
113
|
await optimizeCSS();
|
|
107
114
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/compiler",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"description": "A faster compiler for Plumeria",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
"dist/"
|
|
17
17
|
],
|
|
18
18
|
"bin": {
|
|
19
|
-
"css": "./bin/css.
|
|
19
|
+
"css": "./bin/css.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@swc/core": "^1.11.22",
|
|
23
23
|
"fast-glob": "^3.3.3",
|
|
24
|
-
"jttx": "^1.2.1",
|
|
25
24
|
"lightningcss": "^1.29.3",
|
|
26
25
|
"postcss": "^8.5.3",
|
|
27
|
-
"postcss-combine-duplicated-selectors": "^10.0.3"
|
|
26
|
+
"postcss-combine-duplicated-selectors": "^10.0.3",
|
|
27
|
+
"rscute": "^0.2.4"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|