@plumeria/turbopack-loader 18.3.4 → 18.3.6

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 +8 -6
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -603,10 +603,11 @@ async function loader(source) {
603
603
  if (utils_1.t.isIdentifier(node.id)) {
604
604
  idSpans.add(node.id.span.start);
605
605
  }
606
- let selector = '';
607
606
  const selectorExpr = init.arguments[0].expression;
608
- if (utils_1.t.isStringLiteral(selectorExpr)) {
609
- selector = selectorExpr.value;
607
+ const selector = (0, utils_1.resolveThemeSelector)(selectorExpr, mergedStaticTable, mergedCreateStaticHashTable, scannedTables.createStaticObjectTable);
608
+ if (!selector) {
609
+ throwCompilationError(`Plumeria: createTheme needs a selector it can read at build time. ` +
610
+ `Pass a string literal such as ".dark", or a name this file declares as one.`, selectorExpr);
610
611
  }
611
612
  if (selector.startsWith('@') && !(0, zss_engine_1.isAtRule)(selector)) {
612
613
  throwCompilationError(`Plumeria: Unsupported at-rule: "${selector}". createTheme only supports nesting at-rules such as @media, @container, @supports, @layer, and @scope.`, selectorExpr);
@@ -783,10 +784,11 @@ async function loader(source) {
783
784
  else if (propName === 'createTheme' &&
784
785
  args.length >= 2 &&
785
786
  utils_1.t.isObjectExpression(args[1].expression)) {
786
- let selector = '';
787
787
  const selectorExpr = args[0].expression;
788
- if (utils_1.t.isStringLiteral(selectorExpr)) {
789
- selector = selectorExpr.value;
788
+ const selector = (0, utils_1.resolveThemeSelector)(selectorExpr, mergedStaticTable, mergedCreateStaticHashTable, scannedTables.createStaticObjectTable);
789
+ if (!selector) {
790
+ throwCompilationError(`Plumeria: createTheme needs a selector it can read at build time. ` +
791
+ `Pass a string literal such as ".dark", or a name this file declares as one.`, selectorExpr);
790
792
  }
791
793
  if (selector.startsWith('@') && !(0, zss_engine_1.isAtRule)(selector)) {
792
794
  throwCompilationError(`Plumeria: Unsupported at-rule: "${selector}". createTheme only supports nesting at-rules such as @media, @container, @supports, @layer, and @scope.`, selectorExpr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/turbopack-loader",
3
- "version": "18.3.4",
3
+ "version": "18.3.6",
4
4
  "description": "Plumeria Turbopack-loader",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -29,8 +29,8 @@
29
29
  "zero-virtual.css"
30
30
  ],
31
31
  "dependencies": {
32
- "@plumeria/compiler": "^18.3.4",
33
- "@plumeria/utils": "^18.3.4"
32
+ "@plumeria/compiler": "^18.3.6",
33
+ "@plumeria/utils": "^18.3.6"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@swc/core": "1.15.47",