@plumeria/utils 19.2.16 → 19.4.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.
@@ -0,0 +1 @@
1
+ export declare function resolveExportValue(filePath: string, exportName: string): unknown;
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.resolveExportValue = resolveExportValue;
37
+ const fs = __importStar(require("fs"));
38
+ const core_1 = require("@swc/core");
39
+ const parser_1 = require("./parser");
40
+ const resolver_1 = require("./resolver");
41
+ const constFileCache = new Map();
42
+ function readConstFile(filePath) {
43
+ const { mtimeMs } = fs.statSync(filePath);
44
+ const cached = constFileCache.get(filePath);
45
+ if (cached && cached.mtimeMs === mtimeMs)
46
+ return cached;
47
+ const ast = (0, core_1.parseSync)(fs.readFileSync(filePath, 'utf8'), {
48
+ syntax: 'typescript',
49
+ tsx: true,
50
+ target: 'es2022',
51
+ });
52
+ const values = { ...(0, parser_1.collectLocalConsts)(ast) };
53
+ const imports = {};
54
+ const createStaticNames = new Set();
55
+ const namespaces = new Set();
56
+ for (const node of ast.body) {
57
+ if (node.type !== 'ImportDeclaration')
58
+ continue;
59
+ const source = node.source.value;
60
+ for (const specifier of node.specifiers) {
61
+ const local = specifier.local.value;
62
+ const importedName = specifier.type === 'ImportSpecifier'
63
+ ? (specifier.imported?.value ?? local)
64
+ : specifier.type === 'ImportDefaultSpecifier'
65
+ ? 'default'
66
+ : '*';
67
+ imports[local] = { source, importedName };
68
+ if (source !== '@plumeria/core')
69
+ continue;
70
+ if (importedName === 'createStatic')
71
+ createStaticNames.add(local);
72
+ else if (importedName === '*' || importedName === 'default')
73
+ namespaces.add(local);
74
+ }
75
+ }
76
+ for (const [name, node] of (0, parser_1.collectLocalConstNodes)(ast)) {
77
+ const init = (0, parser_1.unwrapExpression)(node);
78
+ if (!parser_1.t.isCallExpression(init))
79
+ continue;
80
+ const callee = init.callee;
81
+ const isCreateStatic = (parser_1.t.isIdentifier(callee) && createStaticNames.has(callee.value)) ||
82
+ (parser_1.t.isMemberExpression(callee) &&
83
+ parser_1.t.isIdentifier(callee.object) &&
84
+ namespaces.has(callee.object.value) &&
85
+ parser_1.t.isIdentifier(callee.property) &&
86
+ callee.property.value === 'createStatic');
87
+ const argument = (0, parser_1.unwrapExpression)(init.arguments[0]?.expression);
88
+ if (!isCreateStatic || !parser_1.t.isObjectExpression(argument))
89
+ continue;
90
+ try {
91
+ values[name] = (0, parser_1.objectExpressionToObject)(argument, values, {}, {}, {}, {}, {}, {}, {});
92
+ }
93
+ catch {
94
+ continue;
95
+ }
96
+ }
97
+ for (const node of ast.body) {
98
+ if (node.type !== 'ExportDefaultExpression')
99
+ continue;
100
+ const expression = (0, parser_1.unwrapExpression)(node.expression);
101
+ if (parser_1.t.isStringLiteral(expression) || parser_1.t.isNumericLiteral(expression)) {
102
+ values.default = expression.value;
103
+ }
104
+ else if (parser_1.t.isIdentifier(expression) &&
105
+ Object.hasOwn(values, expression.value)) {
106
+ values.default = values[expression.value];
107
+ }
108
+ }
109
+ const file = { mtimeMs, values, imports };
110
+ constFileCache.set(filePath, file);
111
+ return file;
112
+ }
113
+ function resolveExportValue(filePath, exportName) {
114
+ const visited = new Set();
115
+ let name = exportName;
116
+ while (!visited.has(`${filePath}-${name}`)) {
117
+ visited.add(`${filePath}-${name}`);
118
+ const site = (0, parser_1.resolveExport)(filePath, name) ?? { filePath, localName: name };
119
+ let file;
120
+ try {
121
+ file = readConstFile(site.filePath);
122
+ }
123
+ catch {
124
+ return undefined;
125
+ }
126
+ if (Object.hasOwn(file.values, site.localName)) {
127
+ return file.values[site.localName];
128
+ }
129
+ const imported = file.imports[site.localName];
130
+ if (!imported || imported.importedName === '*')
131
+ return undefined;
132
+ const actualPath = (0, resolver_1.resolveImportPath)(imported.source, site.filePath);
133
+ if (!actualPath)
134
+ return undefined;
135
+ filePath = actualPath;
136
+ name = imported.importedName;
137
+ }
138
+ return undefined;
139
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export type { CSSObject, StaticTable, KeyframesHashTable, ViewTransitionHashTable, CreateHashTable, CreateFunctionTable, CreateThemeHashTable, CreateStaticHashTable, } from './types';
2
2
  export { objectExpressionToObject, collectLocalConsts, traverse, t, getRootIdentifier, resolveOriginError, unwrapExpression, extractOndemandStyles, appendSheet, deepMerge, scanAll, scanOverlay, fileTableKeys, resolveFileError, getFileDependencies, resolveExport, resolveComponentKey, resolveThemeSelector, } from './parser';
3
+ export { resolveExportValue } from './constValue';
3
4
  export type { StyleRecord } from './create';
4
5
  export { getStyleRecords } from './create';
5
6
  export type { NamedParam, StyleFunction, StyleFunctions, DynamicStyleTables, DynamicStyleResult, } from './dynamicKey';
@@ -20,3 +21,4 @@ export type { PropertyPolicy, PropertyPolicyOptions } from './propertyPolicy';
20
21
  export { resolvePropertyPolicy, assertPropertyPolicy } from './propertyPolicy';
21
22
  export type { TransformEnv, TransformOutput } from './transform';
22
23
  export { transformSource } from './transform';
24
+ export { needsCompile } from './stylePropFilter';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformSource = exports.assertPropertyPolicy = exports.resolvePropertyPolicy = exports.DEFAULT_STYLE_PROP = exports.timedAsync = exports.timed = exports.tally = exports.measure = exports.mark = exports.profiling = exports.collectReferenceIdentifiers = exports.getLeadingCommentLength = exports.optimizer = exports.resolveImportPath = exports.themeHashOf = exports.getStateWeights = exports.getPseudoElement = exports.getSpecificity = exports.resolveDynamicStyle = exports.applyVarFallback = exports.splitVarByUnit = exports.isUnitlessProp = exports.styleFunctionsOf = exports.getStyleRecords = exports.resolveThemeSelector = exports.resolveComponentKey = exports.resolveExport = exports.getFileDependencies = exports.resolveFileError = exports.fileTableKeys = exports.scanOverlay = exports.scanAll = exports.deepMerge = exports.appendSheet = exports.extractOndemandStyles = exports.unwrapExpression = exports.resolveOriginError = exports.getRootIdentifier = exports.t = exports.traverse = exports.collectLocalConsts = exports.objectExpressionToObject = void 0;
3
+ exports.needsCompile = exports.transformSource = exports.assertPropertyPolicy = exports.resolvePropertyPolicy = exports.DEFAULT_STYLE_PROP = exports.timedAsync = exports.timed = exports.tally = exports.measure = exports.mark = exports.profiling = exports.collectReferenceIdentifiers = exports.getLeadingCommentLength = exports.optimizer = exports.resolveImportPath = exports.themeHashOf = exports.getStateWeights = exports.getPseudoElement = exports.getSpecificity = exports.resolveDynamicStyle = exports.applyVarFallback = exports.splitVarByUnit = exports.isUnitlessProp = exports.styleFunctionsOf = exports.getStyleRecords = exports.resolveExportValue = exports.resolveThemeSelector = exports.resolveComponentKey = exports.resolveExport = exports.getFileDependencies = exports.resolveFileError = exports.fileTableKeys = exports.scanOverlay = exports.scanAll = exports.deepMerge = exports.appendSheet = exports.extractOndemandStyles = exports.unwrapExpression = exports.resolveOriginError = exports.getRootIdentifier = exports.t = exports.traverse = exports.collectLocalConsts = exports.objectExpressionToObject = void 0;
4
4
  var parser_1 = require("./parser");
5
5
  Object.defineProperty(exports, "objectExpressionToObject", { enumerable: true, get: function () { return parser_1.objectExpressionToObject; } });
6
6
  Object.defineProperty(exports, "collectLocalConsts", { enumerable: true, get: function () { return parser_1.collectLocalConsts; } });
@@ -20,6 +20,8 @@ Object.defineProperty(exports, "getFileDependencies", { enumerable: true, get: f
20
20
  Object.defineProperty(exports, "resolveExport", { enumerable: true, get: function () { return parser_1.resolveExport; } });
21
21
  Object.defineProperty(exports, "resolveComponentKey", { enumerable: true, get: function () { return parser_1.resolveComponentKey; } });
22
22
  Object.defineProperty(exports, "resolveThemeSelector", { enumerable: true, get: function () { return parser_1.resolveThemeSelector; } });
23
+ var constValue_1 = require("./constValue");
24
+ Object.defineProperty(exports, "resolveExportValue", { enumerable: true, get: function () { return constValue_1.resolveExportValue; } });
23
25
  var create_1 = require("./create");
24
26
  Object.defineProperty(exports, "getStyleRecords", { enumerable: true, get: function () { return create_1.getStyleRecords; } });
25
27
  var dynamicKey_1 = require("./dynamicKey");
@@ -57,3 +59,5 @@ Object.defineProperty(exports, "resolvePropertyPolicy", { enumerable: true, get:
57
59
  Object.defineProperty(exports, "assertPropertyPolicy", { enumerable: true, get: function () { return propertyPolicy_1.assertPropertyPolicy; } });
58
60
  var transform_1 = require("./transform");
59
61
  Object.defineProperty(exports, "transformSource", { enumerable: true, get: function () { return transform_1.transformSource; } });
62
+ var stylePropFilter_1 = require("./stylePropFilter");
63
+ Object.defineProperty(exports, "needsCompile", { enumerable: true, get: function () { return stylePropFilter_1.needsCompile; } });
package/dist/parser.d.ts CHANGED
@@ -51,8 +51,8 @@ export declare function resolveFileError(actualPath: string, importedName: strin
51
51
  message: string;
52
52
  } | undefined;
53
53
  export declare function fileTableKeys(filePath: string, tableName: string): ReadonlySet<string> | undefined;
54
- export declare function scanOverlay(scanCwd?: string): Tables;
55
- export declare function scanAll(scanCwd?: string): Tables;
54
+ export declare function scanOverlay(scanCwd?: string, styleProp?: string): Tables;
55
+ export declare function scanAll(scanCwd?: string, styleProp?: string): Tables;
56
56
  export declare function getFileDependencies(filePath: string): string[];
57
57
  export declare function resolveExport(filePath: string, exportName: string, visited?: Set<string>): {
58
58
  filePath: string;
package/dist/parser.js CHANGED
@@ -57,6 +57,8 @@ const fs = __importStar(require("fs"));
57
57
  const rs = __importStar(require("@rust-gear/glob"));
58
58
  const zss_engine_1 = require("zss-engine");
59
59
  const viewTransition_1 = require("./viewTransition");
60
+ const constants_1 = require("./constants");
61
+ const stylePropFilter_1 = require("./stylePropFilter");
60
62
  const create_1 = require("./create");
61
63
  const dynamicKey_1 = require("./dynamicKey");
62
64
  const resolver_1 = require("./resolver");
@@ -1072,6 +1074,7 @@ const globalAgregatedTables = {
1072
1074
  let hasComputedOnce = false;
1073
1075
  let resolutionConfigStamp;
1074
1076
  let scannedCwd;
1077
+ let scannedStyleProp;
1075
1078
  const objectTableOwners = new Map();
1076
1079
  const fileObjectContributions = new Map();
1077
1080
  const fileKeyContributions = new Map();
@@ -1233,35 +1236,38 @@ function statFile(filePath) {
1233
1236
  throw e;
1234
1237
  }
1235
1238
  }
1236
- function scanOverlay(scanCwd = process.cwd()) {
1239
+ function scanOverlay(scanCwd = process.cwd(), styleProp = constants_1.DEFAULT_STYLE_PROP) {
1237
1240
  overlayScan = true;
1238
1241
  try {
1239
- return scanAll(scanCwd);
1242
+ return scanAll(scanCwd, styleProp);
1240
1243
  }
1241
1244
  finally {
1242
1245
  overlayScan = false;
1243
1246
  }
1244
1247
  }
1245
- function scanAll(scanCwd = process.cwd()) {
1248
+ function scanAll(scanCwd = process.cwd(), styleProp = constants_1.DEFAULT_STYLE_PROP) {
1246
1249
  scanning = true;
1247
1250
  statMemo.clear();
1248
1251
  try {
1249
- return runScan(scanCwd);
1252
+ return runScan(scanCwd, styleProp);
1250
1253
  }
1251
1254
  finally {
1252
1255
  scanning = false;
1253
1256
  statMemo.clear();
1254
1257
  }
1255
1258
  }
1256
- function runScan(scanCwd = process.cwd()) {
1259
+ function runScan(scanCwd, styleProp) {
1257
1260
  const cwd = path.resolve(scanCwd);
1258
1261
  if (hasComputedOnce &&
1259
1262
  process.env.NODE_ENV === 'production' &&
1260
- scannedCwd === cwd) {
1263
+ scannedCwd === cwd &&
1264
+ scannedStyleProp === styleProp) {
1261
1265
  return snapshotTables();
1262
1266
  }
1263
1267
  const localTables = globalAgregatedTables;
1264
1268
  scannedCwd = cwd;
1269
+ const stylePropChanged = scannedStyleProp !== undefined && scannedStyleProp !== styleProp;
1270
+ scannedStyleProp = styleProp;
1265
1271
  const configPath = path.join(cwd, 'tsconfig.json');
1266
1272
  let configStamp = configPath;
1267
1273
  try {
@@ -1306,7 +1312,10 @@ function runScan(scanCwd = process.cwd()) {
1306
1312
  try {
1307
1313
  const stats = fs.statSync(filePath);
1308
1314
  const cached = fileCache[filePath];
1309
- if (resolutionChanged || !cached || cached.mtimeMs !== stats.mtimeMs) {
1315
+ if (resolutionChanged ||
1316
+ stylePropChanged ||
1317
+ !cached ||
1318
+ cached.mtimeMs !== stats.mtimeMs) {
1310
1319
  invalidated.add(filePath);
1311
1320
  queue.push(filePath);
1312
1321
  }
@@ -1389,7 +1398,7 @@ function runScan(scanCwd = process.cwd()) {
1389
1398
  try {
1390
1399
  const stats = fs.statSync(filePath);
1391
1400
  const source = fs.readFileSync(filePath, 'utf8');
1392
- if (!source.includes('@plumeria/core')) {
1401
+ if (!(0, stylePropFilter_1.needsCompile)(source, styleProp, filePath)) {
1393
1402
  updateDependencyEdges(filePath, fileCache[filePath]?.dependencies, undefined);
1394
1403
  fileCache[filePath] = {
1395
1404
  mtimeMs: stats.mtimeMs,
@@ -0,0 +1,2 @@
1
+ export declare const usesStyleProp: (source: string, styleProp: string, filePath: string) => boolean;
2
+ export declare const needsCompile: (source: string, styleProp: string, filePath: string) => boolean;
@@ -0,0 +1,287 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.needsCompile = exports.usesStyleProp = void 0;
4
+ const CORE = '@plumeria/core';
5
+ const isIdentifierStart = (c) => (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c === 95 || c === 36;
6
+ const isNameChar = (c) => isIdentifierStart(c) || (c >= 48 && c <= 57) || c === 46 || c === 45;
7
+ const isSpace = (c) => c === 32 || (c >= 9 && c <= 13);
8
+ const EXPRESSION_BEFORE = new Set(Array.from('(,=:[!&|?{};+-*%<>~^', (c) => c.charCodeAt(0)));
9
+ const EXPRESSION_WORDS = new Set([
10
+ 'return',
11
+ 'yield',
12
+ 'default',
13
+ 'else',
14
+ 'case',
15
+ 'await',
16
+ 'do',
17
+ 'typeof',
18
+ 'void',
19
+ 'in',
20
+ 'of',
21
+ 'new',
22
+ 'delete',
23
+ 'throw',
24
+ ]);
25
+ const MODE_CODE = 0;
26
+ const MODE_TAG = 1;
27
+ const MODE_CHILDREN = 2;
28
+ const skipTrivia = (source, start) => {
29
+ let i = start;
30
+ while (i < source.length) {
31
+ const c = source.charCodeAt(i);
32
+ if (isSpace(c)) {
33
+ i++;
34
+ }
35
+ else if (c === 47 && source.charCodeAt(i + 1) === 42) {
36
+ const end = source.indexOf('*/', i + 2);
37
+ if (end === -1)
38
+ return source.length;
39
+ i = end + 2;
40
+ }
41
+ else if (c === 47 && source.charCodeAt(i + 1) === 47) {
42
+ const end = source.indexOf('\n', i + 2);
43
+ if (end === -1)
44
+ return source.length;
45
+ i = end + 1;
46
+ }
47
+ else {
48
+ break;
49
+ }
50
+ }
51
+ return i;
52
+ };
53
+ const attributeAt = (source, index, name) => {
54
+ if (index > 0 && isNameChar(source.charCodeAt(index - 1)))
55
+ return false;
56
+ let i = skipTrivia(source, index + name.length);
57
+ if (source.charCodeAt(i) !== 61)
58
+ return false;
59
+ i = skipTrivia(source, i + 1);
60
+ return source.charCodeAt(i) === 123;
61
+ };
62
+ const hasAttributeCandidate = (source, name) => {
63
+ for (let i = source.indexOf(name); i !== -1; i = source.indexOf(name, i + 1)) {
64
+ if (attributeAt(source, i, name))
65
+ return true;
66
+ }
67
+ return false;
68
+ };
69
+ const wordBefore = (source, end) => {
70
+ let start = end;
71
+ while (start > 0 && isNameChar(source.charCodeAt(start - 1)))
72
+ start--;
73
+ return source.slice(start, end);
74
+ };
75
+ const closingQuote = (source, start, quote, multiline) => {
76
+ for (let i = start + 1; i < source.length; i++) {
77
+ const c = source.charCodeAt(i);
78
+ if (c === 92) {
79
+ i++;
80
+ continue;
81
+ }
82
+ if (c === quote)
83
+ return i;
84
+ if (c === 10 && !multiline)
85
+ return -1;
86
+ }
87
+ return -1;
88
+ };
89
+ const writesAttribute = (source, name) => {
90
+ const first = name.charCodeAt(0);
91
+ const stack = [];
92
+ let mode = MODE_CODE;
93
+ let previous = 0;
94
+ let previousEnd = 0;
95
+ const leaveElement = () => {
96
+ mode = stack[stack.length - 1] === 'element' ? MODE_CHILDREN : MODE_CODE;
97
+ previous = 41;
98
+ };
99
+ const templateEnd = (from) => {
100
+ for (let i = from; i < source.length; i++) {
101
+ const c = source.charCodeAt(i);
102
+ if (c === 92) {
103
+ i++;
104
+ continue;
105
+ }
106
+ if (c === 96)
107
+ return i;
108
+ if (c === 36 && source.charCodeAt(i + 1) === 123) {
109
+ stack.push('template');
110
+ return i + 1;
111
+ }
112
+ }
113
+ return -1;
114
+ };
115
+ for (let i = 0; i < source.length; i++) {
116
+ const c = source.charCodeAt(i);
117
+ if (c === first &&
118
+ source.startsWith(name, i) &&
119
+ attributeAt(source, i, name))
120
+ return true;
121
+ if (mode === MODE_TAG) {
122
+ if (c === 47 && source.charCodeAt(i + 1) === 42) {
123
+ const end = source.indexOf('*/', i + 2);
124
+ if (end === -1)
125
+ return true;
126
+ i = end + 1;
127
+ }
128
+ else if (c === 47 && source.charCodeAt(i + 1) === 47) {
129
+ const end = source.indexOf('\n', i + 2);
130
+ if (end === -1)
131
+ return true;
132
+ i = end;
133
+ }
134
+ else if (c === 47 && source.charCodeAt(i + 1) === 62) {
135
+ i++;
136
+ leaveElement();
137
+ }
138
+ else if (c === 62) {
139
+ stack.push('element');
140
+ mode = MODE_CHILDREN;
141
+ }
142
+ else if (c === 123) {
143
+ stack.push('attribute');
144
+ mode = MODE_CODE;
145
+ previous = 123;
146
+ }
147
+ else if (c === 34 || c === 39) {
148
+ const end = closingQuote(source, i, c, true);
149
+ if (end === -1)
150
+ return true;
151
+ i = end;
152
+ }
153
+ continue;
154
+ }
155
+ if (mode === MODE_CHILDREN) {
156
+ if (c === 123) {
157
+ stack.push('child');
158
+ mode = MODE_CODE;
159
+ previous = 123;
160
+ }
161
+ else if (c === 60) {
162
+ if (source.charCodeAt(i + 1) === 47) {
163
+ const end = source.indexOf('>', i);
164
+ if (end === -1)
165
+ return true;
166
+ i = end;
167
+ stack.pop();
168
+ leaveElement();
169
+ }
170
+ else {
171
+ mode = MODE_TAG;
172
+ }
173
+ }
174
+ continue;
175
+ }
176
+ if (isSpace(c))
177
+ continue;
178
+ if (c === 47 && source.charCodeAt(i + 1) === 47) {
179
+ const end = source.indexOf('\n', i);
180
+ if (end === -1)
181
+ return false;
182
+ i = end;
183
+ continue;
184
+ }
185
+ if (c === 47 && source.charCodeAt(i + 1) === 42) {
186
+ const end = source.indexOf('*/', i + 2);
187
+ if (end === -1)
188
+ return true;
189
+ i = end + 1;
190
+ continue;
191
+ }
192
+ if (c === 39 || c === 34) {
193
+ const end = closingQuote(source, i, c, false);
194
+ if (end === -1)
195
+ return true;
196
+ i = end;
197
+ previous = c;
198
+ continue;
199
+ }
200
+ if (c === 96) {
201
+ const end = templateEnd(i + 1);
202
+ if (end === -1)
203
+ return true;
204
+ i = end;
205
+ previous = 96;
206
+ continue;
207
+ }
208
+ if (c === 123) {
209
+ stack.push('brace');
210
+ previous = c;
211
+ continue;
212
+ }
213
+ if (c === 125) {
214
+ const kind = stack.pop();
215
+ if (kind === 'template') {
216
+ const end = templateEnd(i + 1);
217
+ if (end === -1)
218
+ return true;
219
+ i = end;
220
+ previous = 96;
221
+ continue;
222
+ }
223
+ if (kind === 'attribute') {
224
+ mode = MODE_TAG;
225
+ continue;
226
+ }
227
+ if (kind === 'child') {
228
+ mode = MODE_CHILDREN;
229
+ continue;
230
+ }
231
+ if (kind !== 'brace')
232
+ return true;
233
+ previous = c;
234
+ continue;
235
+ }
236
+ const afterUpdate = (previous === 43 || previous === 45) &&
237
+ source.charCodeAt(previousEnd - 2) === previous;
238
+ const expressionStart = previous === 0 ||
239
+ (EXPRESSION_BEFORE.has(previous) && !afterUpdate) ||
240
+ (isNameChar(previous) &&
241
+ EXPRESSION_WORDS.has(wordBefore(source, previousEnd)));
242
+ if (c === 47 && expressionStart) {
243
+ let end = i + 1;
244
+ let inClass = false;
245
+ for (; end < source.length; end++) {
246
+ const d = source.charCodeAt(end);
247
+ if (d === 92) {
248
+ end++;
249
+ continue;
250
+ }
251
+ if (d === 10)
252
+ break;
253
+ if (d === 91)
254
+ inClass = true;
255
+ else if (d === 93)
256
+ inClass = false;
257
+ else if (d === 47 && !inClass)
258
+ break;
259
+ }
260
+ if (source.charCodeAt(end) === 47) {
261
+ i = end;
262
+ previous = 41;
263
+ continue;
264
+ }
265
+ }
266
+ if (c === 60 && expressionStart) {
267
+ const next = source.charCodeAt(i + 1);
268
+ if (isIdentifierStart(next) || next === 62) {
269
+ mode = MODE_TAG;
270
+ continue;
271
+ }
272
+ }
273
+ previous = c;
274
+ previousEnd = i + 1;
275
+ }
276
+ return false;
277
+ };
278
+ const usesStyleProp = (source, styleProp, filePath) => {
279
+ if (filePath.endsWith('.ts') || filePath.endsWith('.mts'))
280
+ return false;
281
+ if (!styleProp || !hasAttributeCandidate(source, styleProp))
282
+ return false;
283
+ return writesAttribute(source, styleProp);
284
+ };
285
+ exports.usesStyleProp = usesStyleProp;
286
+ const needsCompile = (source, styleProp, filePath) => source.includes(CORE) || (0, exports.usesStyleProp)(source, styleProp, filePath);
287
+ exports.needsCompile = needsCompile;
package/dist/transform.js CHANGED
@@ -243,7 +243,7 @@ const transformSource = async (env) => {
243
243
  }
244
244
  }
245
245
  };
246
- const scannedTables = (0, parser_1.scanOverlay)();
246
+ const scannedTables = (0, parser_1.scanOverlay)(undefined, styleProp);
247
247
  const ownFailure = (0, parser_1.resolveFileError)(baseId, '');
248
248
  if (ownFailure)
249
249
  throwCompilationError(`[plumeria] ${ownFailure.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/utils",
3
- "version": "19.2.16",
3
+ "version": "19.4.0",
4
4
  "description": "Plumeria Utils",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",