@csszyx/unplugin 0.10.8 → 0.10.9

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.DlGyBb8o.cjs');
6
+ const unplugin = require('./shared/unplugin.CyZkpgQK.cjs');
7
7
  const types = require('@csszyx/types');
8
8
  require('postcss');
9
9
  require('postcss-selector-parser');
@@ -18,7 +18,7 @@ require('@csszyx/core/native');
18
18
  require('@csszyx/svelte-adapter');
19
19
  require('@csszyx/vue-adapter');
20
20
  require('unplugin');
21
- require('./shared/unplugin.DoBHTRra.cjs');
21
+ require('./shared/unplugin.BCwRIUs_.cjs');
22
22
  require('node:crypto');
23
23
  require('./shared/unplugin.pmTknYLy.cjs');
24
24
  require('postcss-value-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 collectMangleHybridHazards, e as computeSafelistRelPath, f as createGlobalVarAliasValidationOptions, g as createGlobalVarMapAssetSource, h as createGlobalVarScanCacheKey, i as createRSCModuleRecord, j as cssHasContentScope, k as cssImportsTailwind, u as default, l as deleteRSCModuleRecord, m as esbuildPlugin, n as extractGlobalVarAliasesForManifest, o as fileMayContainSafelistableSz, p as findRSCBoundaryViolation, q as findRSCGraphViolation, r as hasInjectableTailwindCandidate, s as hasTokens, t as hasUseClientDirective, v as hasUseServerDirective, w as isCompileSourceOptedIn, x as isHardIgnoredPath, y as isMonorepoPackage, z as isPackagesSkippedSource, A as isRSCServerModule, B as isTailwindReservedGlobalVar, C as mangleCodeClassesSync, D as mangleHybridHazardMessage, E as mergeThemes, F as missingTailwindEntryMessage, G as normalizeGlobalVarAliasesForCache, H as parseThemeBlocks, I as planGlobalVarAliases, J as readGlobalVarScanCache, K as resolveCompileSourceDirs, L as resolveGlobalVarScanCacheDir, M as resolveNativeCacheIdentity, N as rewriteGlobalVarCssAliases, O as rollupPlugin, P as scanGlobalVarCss, Q as shouldEmitWarning, R as shouldWarnMissingTailwindEntry, S as shouldWarnUnscopedMonorepo, T as skippedSzFilesMessage, u as unplugin, U as unscopedMonorepoMessage, V as validateGlobalVarAliasInputs, W as vitePlugin, X as webpackPlugin, Y as writeGlobalVarScanCache } from './shared/unplugin.mdW7U-K4.mjs';
2
+ export { a as appendTailwindSourceDirective, b as assertNoRSCBoundaryViolation, c as assertNoRSCGraphViolation, d as collectMangleHybridHazards, e as computeSafelistRelPath, f as createGlobalVarAliasValidationOptions, g as createGlobalVarMapAssetSource, h as createGlobalVarScanCacheKey, i as createRSCModuleRecord, j as cssHasContentScope, k as cssImportsTailwind, u as default, l as deleteRSCModuleRecord, m as esbuildPlugin, n as extractGlobalVarAliasesForManifest, o as fileMayContainSafelistableSz, p as findRSCBoundaryViolation, q as findRSCGraphViolation, r as hasInjectableTailwindCandidate, s as hasTokens, t as hasUseClientDirective, v as hasUseServerDirective, w as isCompileSourceOptedIn, x as isHardIgnoredPath, y as isMonorepoPackage, z as isPackagesSkippedSource, A as isRSCServerModule, B as isTailwindReservedGlobalVar, C as mangleCodeClassesSync, D as mangleHybridHazardMessage, E as mergeThemes, F as missingTailwindEntryMessage, G as normalizeGlobalVarAliasesForCache, H as parseThemeBlocks, I as planGlobalVarAliases, J as readGlobalVarScanCache, K as resolveCompileSourceDirs, L as resolveGlobalVarScanCacheDir, M as resolveNativeCacheIdentity, N as rewriteGlobalVarCssAliases, O as rollupPlugin, P as scanGlobalVarCss, Q as shouldEmitWarning, R as shouldWarnMissingTailwindEntry, S as shouldWarnUnscopedMonorepo, T as skippedSzFilesMessage, u as unplugin, U as unscopedMonorepoMessage, V as validateGlobalVarAliasInputs, W as vitePlugin, X as webpackPlugin, Y as writeGlobalVarScanCache } from './shared/unplugin.BAOVOPKJ.mjs';
3
3
  export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
4
4
  import 'postcss';
5
5
  import 'postcss-selector-parser';
@@ -14,7 +14,7 @@ import '@csszyx/core/native';
14
14
  import '@csszyx/svelte-adapter';
15
15
  import '@csszyx/vue-adapter';
16
16
  import 'unplugin';
17
- import './shared/unplugin.3UumZ5gn.mjs';
17
+ import './shared/unplugin.B1mblcm-.mjs';
18
18
  import 'node:crypto';
19
19
  import './shared/unplugin.BpWUtI9U.mjs';
20
20
  import 'postcss-value-parser';
@@ -3,13 +3,13 @@
3
3
  const node_crypto = require('node:crypto');
4
4
  const fs = require('node:fs');
5
5
  const path = require('node:path');
6
- const nextTransformMetadata = require('./shared/unplugin.C3H4KqpP.cjs');
7
- const nextWatcherCycle = require('./shared/unplugin.Cwe-dz1f.cjs');
6
+ const nextTransformMetadata = require('./shared/unplugin.BImj9Vcx.cjs');
7
+ const nextWatcherCycle = require('./shared/unplugin.BFN_Ueyx.cjs');
8
8
  const transformCache = require('./shared/unplugin.pmTknYLy.cjs');
9
9
  require('@csszyx/compiler');
10
+ require('./shared/unplugin.BCwRIUs_.cjs');
10
11
  require('node:os');
11
12
  require('proper-lockfile');
12
- require('./shared/unplugin.DoBHTRra.cjs');
13
13
 
14
14
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
15
15
  function _interopNamespaceCompat(e) {
@@ -1,13 +1,13 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import * as path from 'node:path';
4
- import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.D2_Q3rOU.mjs';
5
- import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.CLjhn81z.mjs';
4
+ import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.uLmLkr10.mjs';
5
+ import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.ChwZMl_w.mjs';
6
6
  import { r as resolveTransformCacheDir } from './shared/unplugin.BpWUtI9U.mjs';
7
7
  import '@csszyx/compiler';
8
+ import './shared/unplugin.B1mblcm-.mjs';
8
9
  import 'node:os';
9
10
  import 'proper-lockfile';
10
- import './shared/unplugin.3UumZ5gn.mjs';
11
11
 
12
12
  function runNextPrebuild(options) {
13
13
  assertProductionManglingBoundary(options);
@@ -4,13 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const node_crypto = require('node:crypto');
6
6
  const path = require('node:path');
7
- const nextWatcherCycle = require('./shared/unplugin.Cwe-dz1f.cjs');
8
- const nextTransformMetadata = require('./shared/unplugin.C3H4KqpP.cjs');
7
+ const nextWatcherCycle = require('./shared/unplugin.BFN_Ueyx.cjs');
8
+ const nextTransformMetadata = require('./shared/unplugin.BImj9Vcx.cjs');
9
9
  const transformCache = require('./shared/unplugin.pmTknYLy.cjs');
10
10
  require('node:fs');
11
11
  require('node:os');
12
12
  require('proper-lockfile');
13
- require('./shared/unplugin.DoBHTRra.cjs');
13
+ require('./shared/unplugin.BCwRIUs_.cjs');
14
14
  require('@csszyx/compiler');
15
15
 
16
16
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -1,12 +1,12 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import * as path from 'node:path';
3
- import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle, v as validateNextGenerationManifest, a as readNextGenerationManifest } from './shared/unplugin.CLjhn81z.mjs';
4
- import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.D2_Q3rOU.mjs';
3
+ import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle, v as validateNextGenerationManifest, a as readNextGenerationManifest } from './shared/unplugin.ChwZMl_w.mjs';
4
+ import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.uLmLkr10.mjs';
5
5
  import { r as resolveTransformCacheDir } from './shared/unplugin.BpWUtI9U.mjs';
6
6
  import 'node:fs';
7
7
  import 'node:os';
8
8
  import 'proper-lockfile';
9
- import './shared/unplugin.3UumZ5gn.mjs';
9
+ import './shared/unplugin.B1mblcm-.mjs';
10
10
  import '@csszyx/compiler';
11
11
 
12
12
  const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const path = require('node:path');
4
- const nextWatcherCycle = require('./shared/unplugin.Cwe-dz1f.cjs');
4
+ const nextWatcherCycle = require('./shared/unplugin.BFN_Ueyx.cjs');
5
5
  require('node:fs');
6
6
  require('node:crypto');
7
7
  require('node:os');
8
8
  require('proper-lockfile');
9
- require('./shared/unplugin.DoBHTRra.cjs');
9
+ require('./shared/unplugin.BCwRIUs_.cjs');
10
10
 
11
11
  function _interopNamespaceCompat(e) {
12
12
  if (e && typeof e === 'object' && 'default' in e) return e;
@@ -1,10 +1,10 @@
1
1
  import * as path from 'node:path';
2
- import { r as runNextWatcherCycle } from './shared/unplugin.CLjhn81z.mjs';
2
+ import { r as runNextWatcherCycle } from './shared/unplugin.ChwZMl_w.mjs';
3
3
  import 'node:fs';
4
4
  import 'node:crypto';
5
5
  import 'node:os';
6
6
  import 'proper-lockfile';
7
- import './shared/unplugin.3UumZ5gn.mjs';
7
+ import './shared/unplugin.B1mblcm-.mjs';
8
8
 
9
9
  class NextWatcherLoop {
10
10
  context;
@@ -0,0 +1,9 @@
1
+ function sortStrings(values) {
2
+ return [...values].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
3
+ }
4
+
5
+ function escapeHtmlAttribute(value) {
6
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
7
+ }
8
+
9
+ export { escapeHtmlAttribute as e, sortStrings as s };
@@ -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, isRustTransformAvailable } from '@csszyx/compiler';
8
+ import { scanGlobalVarUsages, sortStrings as sortStrings$1, 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';
@@ -13,7 +13,7 @@ import { isTailwindReservedCustomProperty, CSSZYX_GLOBAL_ALIAS_PREFIX, isCsszyxG
13
13
  import { preprocess } from '@csszyx/vue-adapter';
14
14
  import { createUnplugin } from 'unplugin';
15
15
  import { mangleCSSSync } from '../css-mangler.mjs';
16
- import { e as escapeHtmlAttribute } from './unplugin.3UumZ5gn.mjs';
16
+ import { s as sortStrings, e as escapeHtmlAttribute } from './unplugin.B1mblcm-.mjs';
17
17
  import { createHash } from 'node:crypto';
18
18
  import { r as resolveTransformCacheDir, c as createTransformCacheKey, a as readTransformCache, w as writeTransformCache, e as evictOldTransformCacheEntries } from './unplugin.BpWUtI9U.mjs';
19
19
  import postcss from 'postcss';
@@ -145,7 +145,7 @@ function scanGlobalVarCss(css, options = {}) {
145
145
  filePath,
146
146
  definitions,
147
147
  references,
148
- registered: [...registered].sort(),
148
+ registered: sortStrings(registered),
149
149
  thirdParty: isThirdPartyCssPath(filePath)
150
150
  };
151
151
  }
@@ -164,7 +164,7 @@ function extractVarReferences(value) {
164
164
  for (const match of value.matchAll(VAR_REFERENCE_RE)) {
165
165
  references.add(match[1]);
166
166
  }
167
- return [...references].sort();
167
+ return sortStrings(references);
168
168
  }
169
169
  function isThirdPartyCssPath(filePath) {
170
170
  return filePath.split(/[\\/]/).includes("node_modules");
@@ -205,9 +205,9 @@ function planGlobalVarAliases(input) {
205
205
  entries.push({
206
206
  original,
207
207
  alias,
208
- scopes: [
209
- ...new Set((definitions.get(original) ?? []).map((definition) => definition.scopeId))
210
- ].sort()
208
+ scopes: sortStrings(
209
+ new Set((definitions.get(original) ?? []).map((definition) => definition.scopeId))
210
+ )
211
211
  });
212
212
  }
213
213
  return {
@@ -240,7 +240,7 @@ function collectCandidates(input, definitions) {
240
240
  }
241
241
  }
242
242
  }
243
- return [...candidates].sort();
243
+ return sortStrings(candidates);
244
244
  }
245
245
  function validateCandidates(candidates, definitions, reserved, aliasPrefix) {
246
246
  const diagnostics = [];
@@ -1114,12 +1114,12 @@ function parseThemeBlocks(cssContent) {
1114
1114
  }
1115
1115
  }
1116
1116
  return {
1117
- colors: [...result.colors].sort(),
1118
- spacings: [...result.spacings].sort(),
1119
- fonts: [...result.fonts].sort(),
1120
- radii: [...result.radii].sort(),
1121
- shadows: [...result.shadows].sort(),
1122
- breakpoints: [...result.breakpoints].sort()
1117
+ colors: sortStrings(result.colors),
1118
+ spacings: sortStrings(result.spacings),
1119
+ fonts: sortStrings(result.fonts),
1120
+ radii: sortStrings(result.radii),
1121
+ shadows: sortStrings(result.shadows),
1122
+ breakpoints: sortStrings(result.breakpoints)
1123
1123
  };
1124
1124
  }
1125
1125
  function mergeThemes(themes) {
@@ -1142,12 +1142,12 @@ function mergeThemes(themes) {
1142
1142
  }
1143
1143
  }
1144
1144
  return {
1145
- colors: [...merged.colors].sort(),
1146
- spacings: [...merged.spacings].sort(),
1147
- fonts: [...merged.fonts].sort(),
1148
- radii: [...merged.radii].sort(),
1149
- shadows: [...merged.shadows].sort(),
1150
- breakpoints: [...merged.breakpoints].sort()
1145
+ colors: sortStrings(merged.colors),
1146
+ spacings: sortStrings(merged.spacings),
1147
+ fonts: sortStrings(merged.fonts),
1148
+ radii: sortStrings(merged.radii),
1149
+ shadows: sortStrings(merged.shadows),
1150
+ breakpoints: sortStrings(merged.breakpoints)
1151
1151
  };
1152
1152
  }
1153
1153
  function hasTokens(theme) {
@@ -1267,7 +1267,7 @@ function expandFilePatterns(rootDir, patterns) {
1267
1267
  }
1268
1268
  }
1269
1269
  }
1270
- return Array.from(files).sort();
1270
+ return sortStrings(files);
1271
1271
  }
1272
1272
 
1273
1273
  function safeJsonForScriptTag(value, prettyPrint = false) {
@@ -1361,7 +1361,7 @@ function buildRecoveryManifest(tokens, options) {
1361
1361
  const stripped = options.production === true;
1362
1362
  const strippedDevOnlyPaths = [];
1363
1363
  const sorted = {};
1364
- const sortedKeys = [...tokens.keys()].sort();
1364
+ const sortedKeys = sortStrings(tokens.keys());
1365
1365
  for (const key of sortedKeys) {
1366
1366
  const data = tokens.get(key);
1367
1367
  if (!data) {
@@ -1672,8 +1672,10 @@ function missingTailwindEntryMessage(ownedClassCount) {
1672
1672
  }
1673
1673
  function collectMangleHybridHazards(mangleMap, mangledSources, externalClasses) {
1674
1674
  const tokenValues = new Set(Object.values(mangleMap));
1675
- const collisions = [...tokenValues].filter((token) => externalClasses.has(token)).sort();
1676
- const orphans = Object.keys(mangleMap).filter((source) => !mangledSources.has(source)).sort();
1675
+ const collisions = sortStrings$1([...tokenValues].filter((token) => externalClasses.has(token)));
1676
+ const orphans = sortStrings$1(
1677
+ Object.keys(mangleMap).filter((source) => !mangledSources.has(source))
1678
+ );
1677
1679
  return { collisions, orphans };
1678
1680
  }
1679
1681
  function mangleHybridHazardMessage(hazards) {
@@ -1953,7 +1955,7 @@ CSS alias plan ${actualJson} does not match source-transform alias table ${expec
1953
1955
  }
1954
1956
  function buildVarMangleMap(entriesByFile) {
1955
1957
  const next = {};
1956
- const files = [...entriesByFile.keys()].sort();
1958
+ const files = sortStrings$1(entriesByFile.keys());
1957
1959
  for (const file of files) {
1958
1960
  for (const [original, mangled] of entriesByFile.get(file) ?? []) {
1959
1961
  addVarMangleMapping(next, original, mangled);
@@ -2002,7 +2004,7 @@ function createEarlyGlobalVarAliasEntries(config, aliasPrefix) {
2002
2004
  if (config?.enabled !== true || !config.tokens || config.tokens.length === 0) {
2003
2005
  return [];
2004
2006
  }
2005
- const tokens = [...new Set(config.tokens)].sort();
2007
+ const tokens = sortStrings$1(new Set(config.tokens));
2006
2008
  return tokens.map((original, index) => [original, `${aliasPrefix}${encode(index)}`]);
2007
2009
  }
2008
2010
  function shouldEmitGlobalVarMapAsset(config) {
@@ -2089,7 +2091,7 @@ function collectCSSVariableMetrics(code) {
2089
2091
  }
2090
2092
  function buildCSSVariableMetrics(metricsByFile) {
2091
2093
  const total = emptyCSSVariableMetrics();
2092
- for (const file of [...metricsByFile.keys()].sort()) {
2094
+ for (const file of sortStrings$1(metricsByFile.keys())) {
2093
2095
  const metrics = metricsByFile.get(file);
2094
2096
  if (!metrics) {
2095
2097
  continue;
@@ -3281,7 +3283,7 @@ function createCsszyxPlugins(options = {}) {
3281
3283
  }
3282
3284
  if (!state.skipWarningEmitted && state.skippedSzFiles.size > 0) {
3283
3285
  state.skipWarningEmitted = true;
3284
- emitWarning(skippedSzFilesMessage([...state.skippedSzFiles].sort()), {
3286
+ emitWarning(skippedSzFilesMessage(sortStrings$1(state.skippedSzFiles)), {
3285
3287
  devOnly: true
3286
3288
  });
3287
3289
  }
@@ -3422,7 +3424,9 @@ function createCsszyxPlugins(options = {}) {
3422
3424
  finalizeMangleMap();
3423
3425
  const injectedMangleMap = manglingEnabled ? state.mangleMap : {};
3424
3426
  let result = transformIndexHtml(html, injectedMangleMap, state.checksum, {
3425
- mode: options.production?.injectChecksum === false ? "script" : "script",
3427
+ // Always 'script'; the checksum itself is injected by
3428
+ // injectHydrationData regardless of this mode.
3429
+ mode: "script",
3426
3430
  minify: process.env.NODE_ENV === "production",
3427
3431
  varMangleMap: state.varMangleMap,
3428
3432
  globalVarAliasPrefix
@@ -1,7 +1,12 @@
1
1
  'use strict';
2
2
 
3
+ function sortStrings(values) {
4
+ return [...values].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
5
+ }
6
+
3
7
  function escapeHtmlAttribute(value) {
4
8
  return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
5
9
  }
6
10
 
7
11
  exports.escapeHtmlAttribute = escapeHtmlAttribute;
12
+ exports.sortStrings = sortStrings;
@@ -5,7 +5,7 @@ const fs = require('node:fs');
5
5
  const node_crypto = require('node:crypto');
6
6
  const node_os = require('node:os');
7
7
  const lockfile = require('proper-lockfile');
8
- const htmlEscape = require('./unplugin.DoBHTRra.cjs');
8
+ const htmlEscape = require('./unplugin.BCwRIUs_.cjs');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
11
 
@@ -62,8 +62,8 @@ function materializeNextSafelist(paths, options = {}) {
62
62
  recordsBySource.set(record.data.sourcePath, record);
63
63
  }
64
64
  }
65
- const sortedSources = [...recordsBySource.values()].map(({ data }) => [data.sourcePath, [...new Set(data.classes)].sort()]).sort(([left], [right]) => left.localeCompare(right));
66
- const classNames = [...new Set(sortedSources.flatMap(([, classSet]) => classSet))].sort();
65
+ const sortedSources = [...recordsBySource.values()].map(({ data }) => [data.sourcePath, htmlEscape.sortStrings(new Set(data.classes))]).sort(([left], [right]) => left.localeCompare(right));
66
+ const classNames = htmlEscape.sortStrings(new Set(sortedSources.flatMap(([, classSet]) => classSet)));
67
67
  const snapshot = {
68
68
  version: 1,
69
69
  sources: sortedSources.map(([sourcePath, classSet]) => [sourcePath, classSet])
@@ -192,9 +192,9 @@ function isExistingShardEquivalent(filePath, shard) {
192
192
  }
193
193
  function normalizeShardInput(input) {
194
194
  const sourcePath = path__namespace.resolve(input.sourcePath);
195
- const classes = [
196
- ...new Set(input.classes.map((className) => className.trim()).filter(Boolean))
197
- ].sort();
195
+ const classes = htmlEscape.sortStrings(
196
+ new Set(input.classes.map((className) => className.trim()).filter(Boolean))
197
+ );
198
198
  const cacheKey = input.cacheKey ?? node_crypto.createHash("sha256").update(sourcePath).update("\0").update(input.sourceHash).digest("hex");
199
199
  return {
200
200
  version: 1,
@@ -469,7 +469,7 @@ function stableStringify(value) {
469
469
  }
470
470
  function pickEnv(env, envKeys) {
471
471
  const selected = {};
472
- for (const key of [...new Set(envKeys)].sort()) {
472
+ for (const key of htmlEscape.sortStrings(new Set(envKeys))) {
473
473
  const value = env[key];
474
474
  if (value !== void 0) {
475
475
  selected[key] = value;
@@ -4,6 +4,7 @@ const fs = require('node:fs');
4
4
  const compiler = require('@csszyx/compiler');
5
5
  const transformCache = require('./unplugin.pmTknYLy.cjs');
6
6
  const node_crypto = require('node:crypto');
7
+ const htmlEscape = require('./unplugin.BCwRIUs_.cjs');
7
8
 
8
9
  function readPackageVersion(relativePackageJson, fromUrl) {
9
10
  try {
@@ -197,8 +198,8 @@ function collectNextTransformMetadata(result, source, sourcePath) {
197
198
  return {
198
199
  sourcePath,
199
200
  sourceHash: node_crypto.createHash("sha256").update(source).digest("hex"),
200
- classes: [...classes].sort(),
201
- rawClassNames: [...result.rawClassNames].sort(),
201
+ classes: htmlEscape.sortStrings(classes),
202
+ rawClassNames: htmlEscape.sortStrings(result.rawClassNames),
202
203
  recoveryTokenCount: result.recoveryTokens.size,
203
204
  cssVariableCount: result.cssVariableMap.size
204
205
  };
@@ -3,7 +3,7 @@ import * as fs from 'node:fs';
3
3
  import { createHash } from 'node:crypto';
4
4
  import { hostname } from 'node:os';
5
5
  import lockfile from 'proper-lockfile';
6
- import { e as escapeHtmlAttribute } from './unplugin.3UumZ5gn.mjs';
6
+ import { s as sortStrings, e as escapeHtmlAttribute } from './unplugin.B1mblcm-.mjs';
7
7
 
8
8
  const DEFAULT_RENAME_RETRIES = 5;
9
9
  const DEFAULT_RENAME_RETRY_DELAY_MS = 10;
@@ -42,8 +42,8 @@ function materializeNextSafelist(paths, options = {}) {
42
42
  recordsBySource.set(record.data.sourcePath, record);
43
43
  }
44
44
  }
45
- const sortedSources = [...recordsBySource.values()].map(({ data }) => [data.sourcePath, [...new Set(data.classes)].sort()]).sort(([left], [right]) => left.localeCompare(right));
46
- const classNames = [...new Set(sortedSources.flatMap(([, classSet]) => classSet))].sort();
45
+ const sortedSources = [...recordsBySource.values()].map(({ data }) => [data.sourcePath, sortStrings(new Set(data.classes))]).sort(([left], [right]) => left.localeCompare(right));
46
+ const classNames = sortStrings(new Set(sortedSources.flatMap(([, classSet]) => classSet)));
47
47
  const snapshot = {
48
48
  version: 1,
49
49
  sources: sortedSources.map(([sourcePath, classSet]) => [sourcePath, classSet])
@@ -172,9 +172,9 @@ function isExistingShardEquivalent(filePath, shard) {
172
172
  }
173
173
  function normalizeShardInput(input) {
174
174
  const sourcePath = path.resolve(input.sourcePath);
175
- const classes = [
176
- ...new Set(input.classes.map((className) => className.trim()).filter(Boolean))
177
- ].sort();
175
+ const classes = sortStrings(
176
+ new Set(input.classes.map((className) => className.trim()).filter(Boolean))
177
+ );
178
178
  const cacheKey = input.cacheKey ?? createHash("sha256").update(sourcePath).update("\0").update(input.sourceHash).digest("hex");
179
179
  return {
180
180
  version: 1,
@@ -449,7 +449,7 @@ function stableStringify(value) {
449
449
  }
450
450
  function pickEnv(env, envKeys) {
451
451
  const selected = {};
452
- for (const key of [...new Set(envKeys)].sort()) {
452
+ for (const key of sortStrings(new Set(envKeys))) {
453
453
  const value = env[key];
454
454
  if (value !== void 0) {
455
455
  selected[key] = value;
@@ -13,7 +13,7 @@ const types = require('@csszyx/types');
13
13
  const vueAdapter = require('@csszyx/vue-adapter');
14
14
  const unplugin$1 = require('unplugin');
15
15
  const cssMangler = require('../css-mangler.cjs');
16
- const htmlEscape = require('./unplugin.DoBHTRra.cjs');
16
+ const htmlEscape = require('./unplugin.BCwRIUs_.cjs');
17
17
  const node_crypto = require('node:crypto');
18
18
  const transformCache = require('./unplugin.pmTknYLy.cjs');
19
19
  const postcss = require('postcss');
@@ -165,7 +165,7 @@ function scanGlobalVarCss(css, options = {}) {
165
165
  filePath,
166
166
  definitions,
167
167
  references,
168
- registered: [...registered].sort(),
168
+ registered: htmlEscape.sortStrings(registered),
169
169
  thirdParty: isThirdPartyCssPath(filePath)
170
170
  };
171
171
  }
@@ -184,7 +184,7 @@ function extractVarReferences(value) {
184
184
  for (const match of value.matchAll(VAR_REFERENCE_RE)) {
185
185
  references.add(match[1]);
186
186
  }
187
- return [...references].sort();
187
+ return htmlEscape.sortStrings(references);
188
188
  }
189
189
  function isThirdPartyCssPath(filePath) {
190
190
  return filePath.split(/[\\/]/).includes("node_modules");
@@ -225,9 +225,9 @@ function planGlobalVarAliases(input) {
225
225
  entries.push({
226
226
  original,
227
227
  alias,
228
- scopes: [
229
- ...new Set((definitions.get(original) ?? []).map((definition) => definition.scopeId))
230
- ].sort()
228
+ scopes: htmlEscape.sortStrings(
229
+ new Set((definitions.get(original) ?? []).map((definition) => definition.scopeId))
230
+ )
231
231
  });
232
232
  }
233
233
  return {
@@ -260,7 +260,7 @@ function collectCandidates(input, definitions) {
260
260
  }
261
261
  }
262
262
  }
263
- return [...candidates].sort();
263
+ return htmlEscape.sortStrings(candidates);
264
264
  }
265
265
  function validateCandidates(candidates, definitions, reserved, aliasPrefix) {
266
266
  const diagnostics = [];
@@ -1134,12 +1134,12 @@ function parseThemeBlocks(cssContent) {
1134
1134
  }
1135
1135
  }
1136
1136
  return {
1137
- colors: [...result.colors].sort(),
1138
- spacings: [...result.spacings].sort(),
1139
- fonts: [...result.fonts].sort(),
1140
- radii: [...result.radii].sort(),
1141
- shadows: [...result.shadows].sort(),
1142
- breakpoints: [...result.breakpoints].sort()
1137
+ colors: htmlEscape.sortStrings(result.colors),
1138
+ spacings: htmlEscape.sortStrings(result.spacings),
1139
+ fonts: htmlEscape.sortStrings(result.fonts),
1140
+ radii: htmlEscape.sortStrings(result.radii),
1141
+ shadows: htmlEscape.sortStrings(result.shadows),
1142
+ breakpoints: htmlEscape.sortStrings(result.breakpoints)
1143
1143
  };
1144
1144
  }
1145
1145
  function mergeThemes(themes) {
@@ -1162,12 +1162,12 @@ function mergeThemes(themes) {
1162
1162
  }
1163
1163
  }
1164
1164
  return {
1165
- colors: [...merged.colors].sort(),
1166
- spacings: [...merged.spacings].sort(),
1167
- fonts: [...merged.fonts].sort(),
1168
- radii: [...merged.radii].sort(),
1169
- shadows: [...merged.shadows].sort(),
1170
- breakpoints: [...merged.breakpoints].sort()
1165
+ colors: htmlEscape.sortStrings(merged.colors),
1166
+ spacings: htmlEscape.sortStrings(merged.spacings),
1167
+ fonts: htmlEscape.sortStrings(merged.fonts),
1168
+ radii: htmlEscape.sortStrings(merged.radii),
1169
+ shadows: htmlEscape.sortStrings(merged.shadows),
1170
+ breakpoints: htmlEscape.sortStrings(merged.breakpoints)
1171
1171
  };
1172
1172
  }
1173
1173
  function hasTokens(theme) {
@@ -1287,7 +1287,7 @@ function expandFilePatterns(rootDir, patterns) {
1287
1287
  }
1288
1288
  }
1289
1289
  }
1290
- return Array.from(files).sort();
1290
+ return htmlEscape.sortStrings(files);
1291
1291
  }
1292
1292
 
1293
1293
  function safeJsonForScriptTag(value, prettyPrint = false) {
@@ -1381,7 +1381,7 @@ function buildRecoveryManifest(tokens, options) {
1381
1381
  const stripped = options.production === true;
1382
1382
  const strippedDevOnlyPaths = [];
1383
1383
  const sorted = {};
1384
- const sortedKeys = [...tokens.keys()].sort();
1384
+ const sortedKeys = htmlEscape.sortStrings(tokens.keys());
1385
1385
  for (const key of sortedKeys) {
1386
1386
  const data = tokens.get(key);
1387
1387
  if (!data) {
@@ -1611,9 +1611,9 @@ let _hasWarnedTransformCacheVersion = false;
1611
1611
  let _hasWarnedNativeFallback = false;
1612
1612
  let _hasLoggedActiveParser = false;
1613
1613
  const _babelFallbackFiles = /* @__PURE__ */ new Set();
1614
- 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.DlGyBb8o.cjs', document.baseURI).href)));
1614
+ 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.CyZkpgQK.cjs', document.baseURI).href)));
1615
1615
  const PLUGIN_VERSION = findPackageVersionFromFile(
1616
- node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.DlGyBb8o.cjs', document.baseURI).href))),
1616
+ node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/unplugin.CyZkpgQK.cjs', document.baseURI).href))),
1617
1617
  UNKNOWN_PACKAGE_VERSION
1618
1618
  );
1619
1619
  const COMPILER_VERSION = findPackageVersionFromModule("@csszyx/compiler", UNKNOWN_PACKAGE_VERSION);
@@ -1692,8 +1692,10 @@ function missingTailwindEntryMessage(ownedClassCount) {
1692
1692
  }
1693
1693
  function collectMangleHybridHazards(mangleMap, mangledSources, externalClasses) {
1694
1694
  const tokenValues = new Set(Object.values(mangleMap));
1695
- const collisions = [...tokenValues].filter((token) => externalClasses.has(token)).sort();
1696
- const orphans = Object.keys(mangleMap).filter((source) => !mangledSources.has(source)).sort();
1695
+ const collisions = compiler.sortStrings([...tokenValues].filter((token) => externalClasses.has(token)));
1696
+ const orphans = compiler.sortStrings(
1697
+ Object.keys(mangleMap).filter((source) => !mangledSources.has(source))
1698
+ );
1697
1699
  return { collisions, orphans };
1698
1700
  }
1699
1701
  function mangleHybridHazardMessage(hazards) {
@@ -1973,7 +1975,7 @@ CSS alias plan ${actualJson} does not match source-transform alias table ${expec
1973
1975
  }
1974
1976
  function buildVarMangleMap(entriesByFile) {
1975
1977
  const next = {};
1976
- const files = [...entriesByFile.keys()].sort();
1978
+ const files = compiler.sortStrings(entriesByFile.keys());
1977
1979
  for (const file of files) {
1978
1980
  for (const [original, mangled] of entriesByFile.get(file) ?? []) {
1979
1981
  addVarMangleMapping(next, original, mangled);
@@ -2022,7 +2024,7 @@ function createEarlyGlobalVarAliasEntries(config, aliasPrefix) {
2022
2024
  if (config?.enabled !== true || !config.tokens || config.tokens.length === 0) {
2023
2025
  return [];
2024
2026
  }
2025
- const tokens = [...new Set(config.tokens)].sort();
2027
+ const tokens = compiler.sortStrings(new Set(config.tokens));
2026
2028
  return tokens.map((original, index) => [original, `${aliasPrefix}${core.encode(index)}`]);
2027
2029
  }
2028
2030
  function shouldEmitGlobalVarMapAsset(config) {
@@ -2109,7 +2111,7 @@ function collectCSSVariableMetrics(code) {
2109
2111
  }
2110
2112
  function buildCSSVariableMetrics(metricsByFile) {
2111
2113
  const total = emptyCSSVariableMetrics();
2112
- for (const file of [...metricsByFile.keys()].sort()) {
2114
+ for (const file of compiler.sortStrings(metricsByFile.keys())) {
2113
2115
  const metrics = metricsByFile.get(file);
2114
2116
  if (!metrics) {
2115
2117
  continue;
@@ -3301,7 +3303,7 @@ function createCsszyxPlugins(options = {}) {
3301
3303
  }
3302
3304
  if (!state.skipWarningEmitted && state.skippedSzFiles.size > 0) {
3303
3305
  state.skipWarningEmitted = true;
3304
- emitWarning(skippedSzFilesMessage([...state.skippedSzFiles].sort()), {
3306
+ emitWarning(skippedSzFilesMessage(compiler.sortStrings(state.skippedSzFiles)), {
3305
3307
  devOnly: true
3306
3308
  });
3307
3309
  }
@@ -3442,7 +3444,9 @@ function createCsszyxPlugins(options = {}) {
3442
3444
  finalizeMangleMap();
3443
3445
  const injectedMangleMap = manglingEnabled ? state.mangleMap : {};
3444
3446
  let result = transformIndexHtml(html, injectedMangleMap, state.checksum, {
3445
- mode: options.production?.injectChecksum === false ? "script" : "script",
3447
+ // Always 'script'; the checksum itself is injected by
3448
+ // injectHydrationData regardless of this mode.
3449
+ mode: "script",
3446
3450
  minify: process.env.NODE_ENV === "production",
3447
3451
  varMangleMap: state.varMangleMap,
3448
3452
  globalVarAliasPrefix
@@ -2,6 +2,7 @@ import { readFileSync } from 'node:fs';
2
2
  import { ensureRustTransformAvailable, transformSourceCode, transformRust, transformOxc, transform } from '@csszyx/compiler';
3
3
  import { c as createTransformCacheKey, a as readTransformCache, w as writeTransformCache } from './unplugin.BpWUtI9U.mjs';
4
4
  import { createHash } from 'node:crypto';
5
+ import { s as sortStrings } from './unplugin.B1mblcm-.mjs';
5
6
 
6
7
  function readPackageVersion(relativePackageJson, fromUrl) {
7
8
  try {
@@ -195,8 +196,8 @@ function collectNextTransformMetadata(result, source, sourcePath) {
195
196
  return {
196
197
  sourcePath,
197
198
  sourceHash: createHash("sha256").update(source).digest("hex"),
198
- classes: [...classes].sort(),
199
- rawClassNames: [...result.rawClassNames].sort(),
199
+ classes: sortStrings(classes),
200
+ rawClassNames: sortStrings(result.rawClassNames),
200
201
  recoveryTokenCount: result.recoveryTokens.size,
201
202
  cssVariableCount: result.cssVariableMap.size
202
203
  };
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.DlGyBb8o.cjs');
5
+ const unplugin = require('./shared/unplugin.CyZkpgQK.cjs');
6
6
  require('node:fs');
7
7
  require('node:module');
8
8
  require('node:path');
@@ -18,7 +18,7 @@ require('unplugin');
18
18
  require('./css-mangler.cjs');
19
19
  require('postcss');
20
20
  require('postcss-selector-parser');
21
- require('./shared/unplugin.DoBHTRra.cjs');
21
+ require('./shared/unplugin.BCwRIUs_.cjs');
22
22
  require('node:crypto');
23
23
  require('./shared/unplugin.pmTknYLy.cjs');
24
24
  require('postcss-value-parser');
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { W as vitePlugin } from './shared/unplugin.mdW7U-K4.mjs';
1
+ import { W as vitePlugin } from './shared/unplugin.BAOVOPKJ.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:module';
4
4
  import 'node:path';
@@ -14,7 +14,7 @@ import 'unplugin';
14
14
  import './css-mangler.mjs';
15
15
  import 'postcss';
16
16
  import 'postcss-selector-parser';
17
- import './shared/unplugin.3UumZ5gn.mjs';
17
+ import './shared/unplugin.B1mblcm-.mjs';
18
18
  import 'node:crypto';
19
19
  import './shared/unplugin.BpWUtI9U.mjs';
20
20
  import 'postcss-value-parser';
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.DlGyBb8o.cjs');
5
+ const unplugin = require('./shared/unplugin.CyZkpgQK.cjs');
6
6
  require('node:fs');
7
7
  require('node:module');
8
8
  require('node:path');
@@ -18,7 +18,7 @@ require('unplugin');
18
18
  require('./css-mangler.cjs');
19
19
  require('postcss');
20
20
  require('postcss-selector-parser');
21
- require('./shared/unplugin.DoBHTRra.cjs');
21
+ require('./shared/unplugin.BCwRIUs_.cjs');
22
22
  require('node:crypto');
23
23
  require('./shared/unplugin.pmTknYLy.cjs');
24
24
  require('postcss-value-parser');
package/dist/webpack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { X as webpackPlugin } from './shared/unplugin.mdW7U-K4.mjs';
1
+ import { X as webpackPlugin } from './shared/unplugin.BAOVOPKJ.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:module';
4
4
  import 'node:path';
@@ -14,7 +14,7 @@ import 'unplugin';
14
14
  import './css-mangler.mjs';
15
15
  import 'postcss';
16
16
  import 'postcss-selector-parser';
17
- import './shared/unplugin.3UumZ5gn.mjs';
17
+ import './shared/unplugin.B1mblcm-.mjs';
18
18
  import 'node:crypto';
19
19
  import './shared/unplugin.BpWUtI9U.mjs';
20
20
  import 'postcss-value-parser';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/unplugin",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
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.8",
121
- "@csszyx/core": "0.10.8",
122
- "@csszyx/svelte-adapter": "0.10.8",
123
- "@csszyx/types": "0.10.8",
124
- "@csszyx/vue-adapter": "0.10.8"
120
+ "@csszyx/compiler": "0.10.9",
121
+ "@csszyx/core": "0.10.9",
122
+ "@csszyx/svelte-adapter": "0.10.9",
123
+ "@csszyx/vue-adapter": "0.10.9",
124
+ "@csszyx/types": "0.10.9"
125
125
  },
126
126
  "peerDependencies": {
127
- "@csszyx/runtime": "^0.10.8"
127
+ "@csszyx/runtime": "^0.10.9"
128
128
  },
129
129
  "devDependencies": {
130
130
  "@types/node": "^20.11.0",
@@ -134,7 +134,7 @@
134
134
  "typescript": "^6.0.3",
135
135
  "unbuild": "^3.6.1",
136
136
  "vite": "^8.0.13",
137
- "vitest": "^4.1.6",
137
+ "vitest": "^4.1.9",
138
138
  "webpack": "^5.104.1"
139
139
  },
140
140
  "sideEffects": false,
@@ -1,5 +0,0 @@
1
- function escapeHtmlAttribute(value) {
2
- return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
3
- }
4
-
5
- export { escapeHtmlAttribute as e };