@plumeria/compiler 0.16.2 → 0.17.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/dist/extract.js CHANGED
@@ -210,51 +210,29 @@ function parseCssPropsArguments(args) {
210
210
  }
211
211
  return results;
212
212
  }
213
- async function extractVueAndSvelteAndAstro(filePath) {
213
+ async function extractVueAndSvelte(filePath) {
214
214
  const ext = path.extname(filePath);
215
- if (!(ext === '.svelte' || ext === '.vue' || ext === '.astro'))
215
+ if (!(ext === '.svelte' || ext === '.vue'))
216
216
  return filePath;
217
217
  const code = fs.readFileSync(filePath, 'utf8');
218
- let tsCode = '';
219
218
  const lines = code.split(/\r?\n/);
220
- if (ext === '.astro') {
221
- let inFrontmatter = false;
222
- const contentLines = [];
223
- for (const line of lines) {
224
- const trimmed = line.trim();
225
- if (!inFrontmatter && trimmed === '---') {
226
- inFrontmatter = true;
227
- continue;
228
- }
229
- if (inFrontmatter && trimmed === '---') {
230
- inFrontmatter = false;
231
- continue;
232
- }
233
- if (inFrontmatter) {
234
- contentLines.push(line);
235
- }
219
+ let inScript = false;
220
+ const contentLines = [];
221
+ for (const line of lines) {
222
+ const trimmed = line.trim();
223
+ if (!inScript && /^<script\b/.test(trimmed)) {
224
+ inScript = true;
225
+ continue;
236
226
  }
237
- tsCode = contentLines.join('\n');
238
- }
239
- else {
240
- let inScript = false;
241
- const contentLines = [];
242
- for (const line of lines) {
243
- const trimmed = line.trim();
244
- if (!inScript && /^<script\b/.test(trimmed)) {
245
- inScript = true;
246
- continue;
247
- }
248
- if (inScript && /^<\/script>/.test(trimmed)) {
249
- inScript = false;
250
- continue;
251
- }
252
- if (inScript) {
253
- contentLines.push(line);
254
- }
227
+ if (inScript && /^<\/script>/.test(trimmed)) {
228
+ inScript = false;
229
+ continue;
230
+ }
231
+ if (inScript) {
232
+ contentLines.push(line);
255
233
  }
256
- tsCode = contentLines.join('\n');
257
234
  }
235
+ const tsCode = contentLines.join('\n');
258
236
  const propsMatches = [...extractCssProps(tsCode), ...extractCssProps(code)];
259
237
  const calls = propsMatches
260
238
  .filter(Boolean)
@@ -337,5 +315,5 @@ process.on('unhandledRejection', async (reason, promise) => {
337
315
  module.exports = {
338
316
  extractTSFile,
339
317
  restoreAllOriginals,
340
- extractVueAndSvelteAndAstro,
318
+ extractVueAndSvelte,
341
319
  };
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ const { execute } = require('rscute/execute');
11
11
  const { transform } = require('lightningcss');
12
12
  const { parseSync } = require('@swc/core');
13
13
  const { buildGlobal, buildProps } = require('@plumeria/core/processors');
14
- const { extractTSFile, restoreAllOriginals, extractVueAndSvelteAndAstro, } = require('./extract');
14
+ const { extractTSFile, restoreAllOriginals, extractVueAndSvelte, } = require('./extract');
15
15
  const projectRoot = process.cwd().split('node_modules')[0];
16
16
  const directPath = path.join(projectRoot, 'node_modules/@plumeria/core');
17
17
  const coreFilePath = path.join(directPath, 'stylesheet.css');
@@ -95,7 +95,7 @@ async function optimizeCSS() {
95
95
  }
96
96
  (async () => {
97
97
  await cleanUp();
98
- const files = await glob(path.join(projectRoot, '**/*.{js,jsx,ts,tsx,vue,svelte,astro}'), {
98
+ const files = await glob(path.join(projectRoot, '**/*.{js,jsx,ts,tsx,vue,svelte}'), {
99
99
  exclude: [
100
100
  '**/node_modules/**',
101
101
  '**/dist/**',
@@ -109,7 +109,7 @@ async function optimizeCSS() {
109
109
  for (const file of files) {
110
110
  const ext = path.extname(file);
111
111
  if (ext === '.vue' || ext === '.svelte') {
112
- const tsFile = await extractVueAndSvelteAndAstro(file);
112
+ const tsFile = await extractVueAndSvelte(file);
113
113
  filesSupportExtensions.push(tsFile);
114
114
  }
115
115
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/compiler",
3
- "version": "0.16.2",
3
+ "version": "0.17.0",
4
4
  "description": "Plumeria Rust-based compiler",
5
5
  "repository": {
6
6
  "type": "git",