@plumeria/compiler 0.18.3 → 0.19.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
@@ -187,9 +187,9 @@ function extractCssKeyframes(code) {
187
187
  }
188
188
  return cssCreateMatches.join('\n');
189
189
  }
190
- function extractCssDefineConsts(code) {
190
+ function extractCssViewTransition(code) {
191
191
  const cssCreateMatches = [];
192
- const regex = /(?:(?:\s*const\s+[a-zA-Z0-9_$]+\s*=\s*css\.defineConsts\([\s\S]*?\);\s*))/g;
192
+ const regex = /(?:(?:\s*const\s+[a-zA-Z0-9_$]+\s*=\s*css\.viewTransition\([\s\S]*?\);\s*))/g;
193
193
  let match;
194
194
  while ((match = regex.exec(code))) {
195
195
  if (isInComment(code, match.index) ||
@@ -201,9 +201,9 @@ function extractCssDefineConsts(code) {
201
201
  }
202
202
  return cssCreateMatches.join('\n');
203
203
  }
204
- function extractCssDefineVars(code) {
204
+ function extractCssDefineConsts(code) {
205
205
  const cssCreateMatches = [];
206
- const regex = /(?:(?:\s*const\s+[a-zA-Z0-9_$]+\s*=\s*css\.defineVars\([\s\S]*?\);\s*))/g;
206
+ const regex = /(?:(?:\s*const\s+[a-zA-Z0-9_$]+\s*=\s*css\.defineConsts\([\s\S]*?\);\s*))/g;
207
207
  let match;
208
208
  while ((match = regex.exec(code))) {
209
209
  if (isInComment(code, match.index) ||
@@ -215,9 +215,9 @@ function extractCssDefineVars(code) {
215
215
  }
216
216
  return cssCreateMatches.join('\n');
217
217
  }
218
- function extractCssDefineTheme(code) {
218
+ function extractCssDefineTokens(code) {
219
219
  const cssCreateMatches = [];
220
- const regex = /(?:(?:\s*const\s+[a-zA-Z0-9_$]+\s*=\s*css\.defineTheme\([\s\S]*?\);\s*))/g;
220
+ const regex = /(?:(?:\s*const\s+[a-zA-Z0-9_$]+\s*=\s*css\.defineTokens\([\s\S]*?\);\s*))/g;
221
221
  let match;
222
222
  while ((match = regex.exec(code))) {
223
223
  if (isInComment(code, match.index) ||
@@ -286,9 +286,9 @@ async function extractVueAndSvelte(filePath) {
286
286
  const staticVariableSection = extractStaticStringLiteralVariable(tsCode);
287
287
  const cssCreateSection = extractCssCreate(tsCode);
288
288
  const cssKeyframesSection = extractCssKeyframes(tsCode);
289
+ const cssViewTransitionSection = extractCssViewTransition(tsCode);
289
290
  const cssDefineConstsSection = extractCssDefineConsts(tsCode);
290
- const cssDefineVarsSection = extractCssDefineVars(tsCode);
291
- const cssDefineThemeSection = extractCssDefineTheme(tsCode);
291
+ const cssDefineTokensSection = extractCssDefineTokens(tsCode);
292
292
  let finalCode = '';
293
293
  if (importSection) {
294
294
  finalCode += importSection + '\n';
@@ -299,14 +299,14 @@ async function extractVueAndSvelte(filePath) {
299
299
  if (cssKeyframesSection) {
300
300
  finalCode += cssKeyframesSection + '\n';
301
301
  }
302
+ if (cssViewTransitionSection) {
303
+ finalCode += cssViewTransitionSection + '\n';
304
+ }
302
305
  if (cssDefineConstsSection) {
303
306
  finalCode += cssDefineConstsSection + '\n';
304
307
  }
305
- if (cssDefineVarsSection) {
306
- finalCode += cssDefineVarsSection + '\n';
307
- }
308
- if (cssDefineThemeSection) {
309
- finalCode += cssDefineThemeSection + '\n';
308
+ if (cssDefineTokensSection) {
309
+ finalCode += cssDefineTokensSection + '\n';
310
310
  }
311
311
  if (cssCreateSection) {
312
312
  finalCode += cssCreateSection + '\n';
@@ -327,9 +327,9 @@ async function extractTSFile(filePath) {
327
327
  const staticVariableSection = extractStaticStringLiteralVariable(code);
328
328
  const cssCreateSection = extractCssCreate(code);
329
329
  const cssKeyframesSection = extractCssKeyframes(code);
330
+ const cssViewTransitionSection = extractCssViewTransition(code);
330
331
  const cssDefineConstsSection = extractCssDefineConsts(code);
331
- const cssDefineVarsSection = extractCssDefineVars(code);
332
- const cssDefineThemeSection = extractCssDefineTheme(code);
332
+ const cssDefineTokensSection = extractCssDefineTokens(code);
333
333
  const propsMatches = extractCssProps(code);
334
334
  const calls = propsMatches
335
335
  .filter(Boolean)
@@ -342,12 +342,12 @@ async function extractTSFile(filePath) {
342
342
  finalCode += staticVariableSection + '\n';
343
343
  if (cssKeyframesSection)
344
344
  finalCode += cssKeyframesSection + '\n';
345
+ if (cssViewTransitionSection)
346
+ finalCode += cssViewTransitionSection + '\n';
345
347
  if (cssDefineConstsSection)
346
348
  finalCode += cssDefineConstsSection + '\n';
347
- if (cssDefineVarsSection)
348
- finalCode += cssDefineVarsSection + '\n';
349
- if (cssDefineThemeSection)
350
- finalCode += cssDefineThemeSection + '\n';
349
+ if (cssDefineTokensSection)
350
+ finalCode += cssDefineTokensSection + '\n';
351
351
  if (cssCreateSection)
352
352
  finalCode += cssCreateSection + '\n';
353
353
  finalCode += calls;
package/dist/index.js CHANGED
@@ -46,16 +46,28 @@ else {
46
46
  }
47
47
  }
48
48
  let coreFilePath;
49
- try {
50
- const corePackageJsonPath = require.resolve('@plumeria/core/package.json', {
51
- paths: [projectRoot, process.cwd()],
52
- });
53
- coreFilePath = path.join(path.dirname(corePackageJsonPath), 'stylesheet.css');
49
+ const coreSourcePackageJsonPath = path.join(process.cwd(), 'package.json');
50
+ const coreSourcePackageJson = JSON.parse(fs.readFileSync(coreSourcePackageJsonPath, 'utf-8'));
51
+ const dependencies = {
52
+ ...coreSourcePackageJson.dependencies,
53
+ ...coreSourcePackageJson.devDependencies,
54
+ };
55
+ const coreVersion = dependencies['@plumeria/core'];
56
+ const resolvedCorePackageJsonPath = require.resolve('@plumeria/core/package.json', {
57
+ paths: [projectRoot, process.cwd()],
58
+ });
59
+ if (workspaceRootFile) {
60
+ if (coreVersion.includes('workspace')) {
61
+ coreFilePath = path.join(path.dirname(resolvedCorePackageJsonPath), 'stylesheet.css');
62
+ }
63
+ else {
64
+ const corePackageJson = JSON.parse(fs.readFileSync(resolvedCorePackageJsonPath, 'utf-8'));
65
+ const exactCoreVersion = corePackageJson.version;
66
+ coreFilePath = path.join(projectRoot, 'node_modules', '.pnpm', `@plumeria+core@${exactCoreVersion}`, 'node_modules', '@plumeria', 'core', 'stylesheet.css');
67
+ }
54
68
  }
55
- catch (error) {
56
- console.error('Could not find "@plumeria/core/stylesheet.css". Please make sure it is installed.' +
57
- error);
58
- process.exit(1);
69
+ else {
70
+ coreFilePath = path.join(path.dirname(resolvedCorePackageJsonPath), 'stylesheet.css');
59
71
  }
60
72
  const cleanUp = async () => {
61
73
  if (process.env.CI && existsSync(coreFilePath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/compiler",
3
- "version": "0.18.3",
3
+ "version": "0.19.0",
4
4
  "description": "Plumeria Rust-based compiler",
5
5
  "repository": {
6
6
  "type": "git",