@csszyx/unplugin 0.10.5 → 0.10.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.
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const cssMangler = require('./css-mangler.cjs');
6
- const unplugin = require('./shared/unplugin.nVFTcBVL.cjs');
6
+ const unplugin = require('./shared/unplugin.CjxItfV1.cjs');
7
7
  const types = require('@csszyx/types');
8
8
  require('postcss');
9
9
  require('postcss-selector-parser');
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  export { createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
2
- export { a as appendTailwindSourceDirective, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as computeSafelistRelPath, e as createGlobalVarAliasValidationOptions, f as createGlobalVarMapAssetSource, g as createGlobalVarScanCacheKey, h as createRSCModuleRecord, i as cssHasContentScope, j as cssImportsTailwind, u as default, k as deleteRSCModuleRecord, l as esbuildPlugin, m as extractGlobalVarAliasesForManifest, n as fileMayContainSafelistableSz, o as findRSCBoundaryViolation, p as findRSCGraphViolation, q as hasInjectableTailwindCandidate, r as hasTokens, s as hasUseClientDirective, t as hasUseServerDirective, v as isCompileSourceOptedIn, w as isHardIgnoredPath, x as isMonorepoPackage, y as isPackagesSkippedSource, z as isRSCServerModule, A as isTailwindReservedGlobalVar, B as mangleCodeClassesSync, C as mergeThemes, D as missingTailwindEntryMessage, E as normalizeGlobalVarAliasesForCache, F as parseThemeBlocks, G as planGlobalVarAliases, H as readGlobalVarScanCache, I as resolveCompileSourceDirs, J as resolveGlobalVarScanCacheDir, K as resolveNativeCacheIdentity, L as rewriteGlobalVarCssAliases, M as rollupPlugin, N as scanGlobalVarCss, O as shouldEmitWarning, P as shouldWarnMissingTailwindEntry, Q as shouldWarnUnscopedMonorepo, R as skippedSzFilesMessage, u as unplugin, S as unscopedMonorepoMessage, T as validateGlobalVarAliasInputs, U as vitePlugin, V as webpackPlugin, W as writeGlobalVarScanCache } from './shared/unplugin.BaRxZXyj.mjs';
2
+ export { a as appendTailwindSourceDirective, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as computeSafelistRelPath, e as createGlobalVarAliasValidationOptions, f as createGlobalVarMapAssetSource, g as createGlobalVarScanCacheKey, h as createRSCModuleRecord, i as cssHasContentScope, j as cssImportsTailwind, u as default, k as deleteRSCModuleRecord, l as esbuildPlugin, m as extractGlobalVarAliasesForManifest, n as fileMayContainSafelistableSz, o as findRSCBoundaryViolation, p as findRSCGraphViolation, q as hasInjectableTailwindCandidate, r as hasTokens, s as hasUseClientDirective, t as hasUseServerDirective, v as isCompileSourceOptedIn, w as isHardIgnoredPath, x as isMonorepoPackage, y as isPackagesSkippedSource, z as isRSCServerModule, A as isTailwindReservedGlobalVar, B as mangleCodeClassesSync, C as mergeThemes, D as missingTailwindEntryMessage, E as normalizeGlobalVarAliasesForCache, F as parseThemeBlocks, G as planGlobalVarAliases, H as readGlobalVarScanCache, I as resolveCompileSourceDirs, J as resolveGlobalVarScanCacheDir, K as resolveNativeCacheIdentity, L as rewriteGlobalVarCssAliases, M as rollupPlugin, N as scanGlobalVarCss, O as shouldEmitWarning, P as shouldWarnMissingTailwindEntry, Q as shouldWarnUnscopedMonorepo, R as skippedSzFilesMessage, u as unplugin, S as unscopedMonorepoMessage, T as validateGlobalVarAliasInputs, U as vitePlugin, V as webpackPlugin, W as writeGlobalVarScanCache } from './shared/unplugin.CDjxWs9r.mjs';
3
3
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
4
4
  import 'postcss';
5
5
  import 'postcss-selector-parser';
@@ -5,7 +5,7 @@ import * as path from 'node:path';
5
5
  import { dirname } from 'node:path';
6
6
  import { performance } from 'node:perf_hooks';
7
7
  import { fileURLToPath } from 'node:url';
8
- import { scanGlobalVarUsages, ensureRustTransformAvailable, transformSourceCode, transformRust, transformOxc, transformRustBatch, transform } from '@csszyx/compiler';
8
+ import { scanGlobalVarUsages, ensureRustTransformAvailable, transformSourceCode, transformRust, transformOxc, transformRustBatch, transform, isRustTransformAvailable } from '@csszyx/compiler';
9
9
  import { encode, compute_mangle_checksum } from '@csszyx/core';
10
10
  import { getNativePackageName } from '@csszyx/core/native';
11
11
  import { preprocess as preprocess$1 } from '@csszyx/svelte-adapter';
@@ -1405,6 +1405,20 @@ function escapeForDoubleQuotedString(value) {
1405
1405
  return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
1406
1406
  }
1407
1407
 
1408
+ function isParserMode(value) {
1409
+ return value === "rust" || value === "oxc" || value === "babel";
1410
+ }
1411
+ function resolveParserMode(input) {
1412
+ const { configParser, envParser, defaultParser, isRustAvailable } = input;
1413
+ const envValid = isParserMode(envParser);
1414
+ const explicit = envValid || configParser != null;
1415
+ const parser = envValid ? envParser : configParser ?? defaultParser;
1416
+ if (parser === "rust" && !explicit && !isRustAvailable()) {
1417
+ return { parser: "oxc", degraded: true, explicit: false };
1418
+ }
1419
+ return { parser, degraded: false, explicit };
1420
+ }
1421
+
1408
1422
  const DEFAULT_MAX_ATTEMPTS = 3;
1409
1423
  const NODE_FS = {
1410
1424
  openSync: fs.openSync,
@@ -1574,6 +1588,7 @@ const RUNTIME_HELPER_IMPORT_RE = {
1574
1588
  };
1575
1589
  let _hasWarnedTsConfig = false;
1576
1590
  let _hasWarnedTransformCacheVersion = false;
1591
+ let _hasWarnedNativeFallback = false;
1577
1592
  const requireFromHere = createRequire(import.meta.url);
1578
1593
  const PLUGIN_VERSION = findPackageVersionFromFile(
1579
1594
  fileURLToPath(import.meta.url),
@@ -2403,9 +2418,18 @@ function createCsszyxPlugins(options = {}) {
2403
2418
  console.warn(message);
2404
2419
  }
2405
2420
  }
2406
- const parserOverride = process.env.CSSZYX_PARSER;
2407
- const defaultParser = DEFAULT_BUILD_CONFIG.parser ?? "rust";
2408
- const parserMode = parserOverride === "babel" || parserOverride === "oxc" || parserOverride === "rust" ? parserOverride : options.build?.parser ?? defaultParser;
2421
+ const { parser: parserMode, degraded: parserDegraded } = resolveParserMode({
2422
+ configParser: options.build?.parser,
2423
+ envParser: process.env.CSSZYX_PARSER,
2424
+ defaultParser: DEFAULT_BUILD_CONFIG.parser ?? "rust",
2425
+ isRustAvailable: isRustTransformAvailable
2426
+ });
2427
+ if (parserDegraded && !_hasWarnedNativeFallback) {
2428
+ _hasWarnedNativeFallback = true;
2429
+ console.warn(
2430
+ "[csszyx] No prebuilt native binary (@csszyx/core-*) is available for this platform, so the default `rust` parser fell back to `oxc`. Output classes are identical (parity-tested); only parse speed differs. To use the native engine, install the matching @csszyx/core-<platform> package (or do not omit optional dependencies). Set `build.parser` explicitly to silence this."
2431
+ );
2432
+ }
2409
2433
  let evictedCacheRoot = null;
2410
2434
  const transformMemoryCache = /* @__PURE__ */ new Map();
2411
2435
  const state = {
@@ -2793,7 +2817,7 @@ function createCsszyxPlugins(options = {}) {
2793
2817
  scanDir(sourceDir);
2794
2818
  }
2795
2819
  for (const { filePath, result } of transformPrescanSources(prescanSources)) {
2796
- if (!result.transformed) {
2820
+ if (!result.transformed && result.classes.size === 0) {
2797
2821
  continue;
2798
2822
  }
2799
2823
  collectPrescanResult(result, filePath, discoveredClasses, rawDiscoveredClasses);
@@ -1425,6 +1425,20 @@ function escapeForDoubleQuotedString(value) {
1425
1425
  return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
1426
1426
  }
1427
1427
 
1428
+ function isParserMode(value) {
1429
+ return value === "rust" || value === "oxc" || value === "babel";
1430
+ }
1431
+ function resolveParserMode(input) {
1432
+ const { configParser, envParser, defaultParser, isRustAvailable } = input;
1433
+ const envValid = isParserMode(envParser);
1434
+ const explicit = envValid || configParser != null;
1435
+ const parser = envValid ? envParser : configParser ?? defaultParser;
1436
+ if (parser === "rust" && !explicit && !isRustAvailable()) {
1437
+ return { parser: "oxc", degraded: true, explicit: false };
1438
+ }
1439
+ return { parser, degraded: false, explicit };
1440
+ }
1441
+
1428
1442
  const DEFAULT_MAX_ATTEMPTS = 3;
1429
1443
  const NODE_FS = {
1430
1444
  openSync: fs__namespace.openSync,
@@ -1594,9 +1608,10 @@ const RUNTIME_HELPER_IMPORT_RE = {
1594
1608
  };
1595
1609
  let _hasWarnedTsConfig = false;
1596
1610
  let _hasWarnedTransformCacheVersion = false;
1597
- const requireFromHere = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.nVFTcBVL.cjs', document.baseURI).href)));
1611
+ let _hasWarnedNativeFallback = false;
1612
+ const requireFromHere = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.CjxItfV1.cjs', document.baseURI).href)));
1598
1613
  const PLUGIN_VERSION = findPackageVersionFromFile(
1599
- node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.nVFTcBVL.cjs', document.baseURI).href))),
1614
+ node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.CjxItfV1.cjs', document.baseURI).href))),
1600
1615
  UNKNOWN_PACKAGE_VERSION
1601
1616
  );
1602
1617
  const COMPILER_VERSION = findPackageVersionFromModule("@csszyx/compiler", UNKNOWN_PACKAGE_VERSION);
@@ -2423,9 +2438,18 @@ function createCsszyxPlugins(options = {}) {
2423
2438
  console.warn(message);
2424
2439
  }
2425
2440
  }
2426
- const parserOverride = process.env.CSSZYX_PARSER;
2427
- const defaultParser = types.DEFAULT_BUILD_CONFIG.parser ?? "rust";
2428
- const parserMode = parserOverride === "babel" || parserOverride === "oxc" || parserOverride === "rust" ? parserOverride : options.build?.parser ?? defaultParser;
2441
+ const { parser: parserMode, degraded: parserDegraded } = resolveParserMode({
2442
+ configParser: options.build?.parser,
2443
+ envParser: process.env.CSSZYX_PARSER,
2444
+ defaultParser: types.DEFAULT_BUILD_CONFIG.parser ?? "rust",
2445
+ isRustAvailable: compiler.isRustTransformAvailable
2446
+ });
2447
+ if (parserDegraded && !_hasWarnedNativeFallback) {
2448
+ _hasWarnedNativeFallback = true;
2449
+ console.warn(
2450
+ "[csszyx] No prebuilt native binary (@csszyx/core-*) is available for this platform, so the default `rust` parser fell back to `oxc`. Output classes are identical (parity-tested); only parse speed differs. To use the native engine, install the matching @csszyx/core-<platform> package (or do not omit optional dependencies). Set `build.parser` explicitly to silence this."
2451
+ );
2452
+ }
2429
2453
  let evictedCacheRoot = null;
2430
2454
  const transformMemoryCache = /* @__PURE__ */ new Map();
2431
2455
  const state = {
@@ -2813,7 +2837,7 @@ function createCsszyxPlugins(options = {}) {
2813
2837
  scanDir(sourceDir);
2814
2838
  }
2815
2839
  for (const { filePath, result } of transformPrescanSources(prescanSources)) {
2816
- if (!result.transformed) {
2840
+ if (!result.transformed && result.classes.size === 0) {
2817
2841
  continue;
2818
2842
  }
2819
2843
  collectPrescanResult(result, filePath, discoveredClasses, rawDiscoveredClasses);
package/dist/vite.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const unplugin = require('./shared/unplugin.nVFTcBVL.cjs');
5
+ const unplugin = require('./shared/unplugin.CjxItfV1.cjs');
6
6
  require('node:fs');
7
7
  require('node:module');
8
8
  require('node:path');
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { U as vitePlugin } from './shared/unplugin.BaRxZXyj.mjs';
1
+ import { U as vitePlugin } from './shared/unplugin.CDjxWs9r.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:module';
4
4
  import 'node:path';
package/dist/webpack.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const unplugin = require('./shared/unplugin.nVFTcBVL.cjs');
5
+ const unplugin = require('./shared/unplugin.CjxItfV1.cjs');
6
6
  require('node:fs');
7
7
  require('node:module');
8
8
  require('node:path');
package/dist/webpack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { V as webpackPlugin } from './shared/unplugin.BaRxZXyj.mjs';
1
+ import { V as webpackPlugin } from './shared/unplugin.CDjxWs9r.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:module';
4
4
  import 'node:path';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/unplugin",
3
- "version": "0.10.5",
3
+ "version": "0.10.6",
4
4
  "description": "Vite and Webpack integration for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -117,14 +117,14 @@
117
117
  "postcss-value-parser": "^4.2.0",
118
118
  "proper-lockfile": "^4.1.2",
119
119
  "unplugin": "^1.10.1",
120
- "@csszyx/compiler": "0.10.5",
121
- "@csszyx/core": "0.10.5",
122
- "@csszyx/svelte-adapter": "0.10.5",
123
- "@csszyx/vue-adapter": "0.10.5",
124
- "@csszyx/types": "0.10.5"
120
+ "@csszyx/compiler": "0.10.6",
121
+ "@csszyx/svelte-adapter": "0.10.6",
122
+ "@csszyx/types": "0.10.6",
123
+ "@csszyx/core": "0.10.6",
124
+ "@csszyx/vue-adapter": "0.10.6"
125
125
  },
126
126
  "peerDependencies": {
127
- "@csszyx/runtime": "^0.10.5"
127
+ "@csszyx/runtime": "^0.10.6"
128
128
  },
129
129
  "devDependencies": {
130
130
  "@types/node": "^20.11.0",