@plumeria/compiler 0.8.6 → 0.8.8

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.
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import fs from 'fs';
4
- import path from 'path';
5
- import { execSync } from 'child_process';
6
- import { styleText } from 'util';
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 --import jttx compiler/dist/index.js ` + argv, {
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
- import * as path from 'path';
2
- import { unlinkSync, existsSync } from 'fs';
3
- import { readFile, writeFile } from 'fs/promises';
4
- import fg from 'fast-glob';
5
- import postcss from 'postcss';
6
- import combineSelectors from 'postcss-combine-duplicated-selectors';
7
- import { transform } from 'lightningcss';
8
- import { parseSync } from '@swc/core';
9
- import { buildGlobal, buildCreate } from '@plumeria/core/build-helper';
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
- async function isCSS(filePath) {
26
- const code = await readFile(filePath, 'utf8');
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.forEach(visit);
49
+ for (const item of value) {
50
+ visit(item);
51
+ }
48
52
  }
49
53
  else {
50
54
  visit(value);
@@ -89,10 +93,9 @@ async function getAppRoot() {
89
93
  const files = await fg([path.join(appRoot, '**/*.{js,jsx,ts,tsx}')], {
90
94
  ignore: ['**/node_modules/**', '**/dist/**', '**/.next/**'],
91
95
  });
92
- const results = await Promise.all(files.map((file) => isCSS(file)));
93
- const styleFiles = files.filter((_, i) => results[i]);
96
+ const styleFiles = files.filter(isCSS).sort();
94
97
  for (let i = 0; i < styleFiles.length; i++) {
95
- await import(path.resolve(styleFiles[i]));
98
+ await execute(path.resolve(styleFiles[i]));
96
99
  if (process.argv.includes('--paths'))
97
100
  console.log(styleFiles[i]);
98
101
  }
@@ -101,7 +104,6 @@ async function getAppRoot() {
101
104
  }
102
105
  for (let i = 0; i < styleFiles.length; i++) {
103
106
  await buildCreate(coreFilePath);
104
- await new Promise((resolve) => setImmediate(resolve));
105
107
  }
106
108
  await optimizeCSS();
107
109
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/compiler",
3
- "version": "0.8.6",
3
+ "version": "0.8.8",
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.mjs"
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"