@plumeria/compiler 0.18.0 → 0.18.2

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -46,15 +46,16 @@ else {
46
46
  }
47
47
  }
48
48
  let coreFilePath;
49
- if (workspaceRootFile) {
50
- const coreSourcePackageJsonPath = path.join(projectRoot, 'packages', 'core', 'package.json');
51
- const coreSourcePackageJson = JSON.parse(fs.readFileSync(coreSourcePackageJsonPath, 'utf-8'));
52
- const coreVersion = coreSourcePackageJson.version;
53
- coreFilePath = path.join(projectRoot, 'node_modules', '.pnpm', `@plumeria+core@${coreVersion}`, 'node_modules', '@plumeria', 'core', 'stylesheet.css');
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');
54
54
  }
55
- else {
56
- const coreInstalledPath = path.dirname(require.resolve('@plumeria/core/package.json'));
57
- coreFilePath = path.join(coreInstalledPath, 'stylesheet.css');
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);
58
59
  }
59
60
  const cleanUp = async () => {
60
61
  if (process.env.CI && existsSync(coreFilePath)) {
@@ -68,7 +69,7 @@ const cleanUp = async () => {
68
69
  console.error('An error occurred:', err);
69
70
  }
70
71
  };
71
- function isCSS(filePath, target) {
72
+ function isCSS(filePath) {
72
73
  if (statSync(filePath).isDirectory()) {
73
74
  return false;
74
75
  }
@@ -83,13 +84,7 @@ function isCSS(filePath, target) {
83
84
  function visit(node) {
84
85
  if (node.type === 'MemberExpression' && node.property?.value) {
85
86
  if (node.object?.type === 'Identifier' && node.object.value === 'css') {
86
- if (target === 'props') {
87
- if (node.property.value === 'props') {
88
- found = true;
89
- }
90
- }
91
- else if (node.property.value === 'props' ||
92
- node.property.value === 'global') {
87
+ if (node.property.value === 'props') {
93
88
  found = true;
94
89
  }
95
90
  }
@@ -153,11 +148,8 @@ async function optimizeCSS() {
153
148
  }
154
149
  }
155
150
  const styleFiles = filesSupportExtensions
156
- .filter((file) => isCSS(file, ''))
151
+ .filter((file) => isCSS(file))
157
152
  .sort();
158
- const propsFiles = styleFiles.filter((file) => {
159
- return isCSS(file, 'props');
160
- });
161
153
  for (let i = 0; i < styleFiles.length; i++) {
162
154
  await execute(path.resolve(styleFiles[i]));
163
155
  if (process.argv.includes('--paths'))
@@ -166,7 +158,7 @@ async function optimizeCSS() {
166
158
  for (let i = 0; i < styleFiles.length; i++) {
167
159
  await buildGlobal(coreFilePath);
168
160
  }
169
- for (let i = 0; i < propsFiles.length; i++) {
161
+ for (let i = 0; i < styleFiles.length; i++) {
170
162
  await buildProps(coreFilePath);
171
163
  }
172
164
  await optimizeCSS();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/compiler",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "Plumeria Rust-based compiler",
5
5
  "repository": {
6
6
  "type": "git",