@csszyx/unplugin 0.10.12 → 0.11.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.
- package/dist/index.cjs +6 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -3
- package/dist/next-prebuild.cjs +2 -2
- package/dist/next-prebuild.mjs +2 -2
- package/dist/next-turbo-loader.cjs +10 -8
- package/dist/next-turbo-loader.mjs +10 -8
- package/dist/shared/unplugin.B3RHYokB.mjs +29 -0
- package/dist/shared/{unplugin.B45ZkNXD.mjs → unplugin.B3cvNxnk.mjs} +1 -1
- package/dist/shared/{unplugin.DO7Y2Y-X.mjs → unplugin.BS60onPk.mjs} +325 -74
- package/dist/shared/{unplugin.CGqFVGlB.mjs → unplugin.ByzV6iZE.mjs} +5 -1
- package/dist/shared/{unplugin.Bh2aAL4a.cjs → unplugin.CBKZoxQ1.cjs} +1 -1
- package/dist/shared/{unplugin.CoiN0OSE.cjs → unplugin.CP2cz9bA.cjs} +327 -74
- package/dist/shared/{unplugin.D32Rb29j.cjs → unplugin.D0N9bprz.cjs} +5 -1
- package/dist/shared/{unplugin.D3qsS8Pe.d.cts → unplugin.PhOFTQpB.d.cts} +31 -1
- package/dist/shared/{unplugin.D3qsS8Pe.d.mts → unplugin.PhOFTQpB.d.mts} +31 -1
- package/dist/shared/unplugin.Rov-j_Wm.cjs +32 -0
- package/dist/vite.cjs +4 -3
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +4 -3
- package/dist/webpack.cjs +4 -3
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.mjs +4 -3
- package/package.json +8 -7
package/dist/index.cjs
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const cssMangler = require('./css-mangler.cjs');
|
|
6
|
-
const unplugin = require('./shared/unplugin.
|
|
6
|
+
const unplugin = require('./shared/unplugin.CP2cz9bA.cjs');
|
|
7
7
|
const types = require('@csszyx/types');
|
|
8
8
|
require('postcss');
|
|
9
9
|
require('postcss-selector-parser');
|
|
10
|
+
require('node:crypto');
|
|
10
11
|
require('node:fs');
|
|
11
12
|
require('node:module');
|
|
12
13
|
require('node:path');
|
|
@@ -19,8 +20,8 @@ require('@csszyx/svelte-adapter');
|
|
|
19
20
|
require('@csszyx/vue-adapter');
|
|
20
21
|
require('unplugin');
|
|
21
22
|
require('./shared/unplugin.BCwRIUs_.cjs');
|
|
22
|
-
require('
|
|
23
|
-
require('./shared/unplugin.
|
|
23
|
+
require('./shared/unplugin.Rov-j_Wm.cjs');
|
|
24
|
+
require('./shared/unplugin.D0N9bprz.cjs');
|
|
24
25
|
require('postcss-value-parser');
|
|
25
26
|
|
|
26
27
|
|
|
@@ -46,6 +47,7 @@ exports.deleteRSCModuleRecord = unplugin.deleteRSCModuleRecord;
|
|
|
46
47
|
exports.esbuildPlugin = unplugin.esbuildPlugin;
|
|
47
48
|
exports.extractGlobalVarAliasesForManifest = unplugin.extractGlobalVarAliasesForManifest;
|
|
48
49
|
exports.fileMayContainSafelistableSz = unplugin.fileMayContainSafelistableSz;
|
|
50
|
+
exports.findLocalImportSources = unplugin.findLocalImportSources;
|
|
49
51
|
exports.findRSCBoundaryViolation = unplugin.findRSCBoundaryViolation;
|
|
50
52
|
exports.findRSCGraphViolation = unplugin.findRSCGraphViolation;
|
|
51
53
|
exports.hasInjectableTailwindCandidate = unplugin.hasInjectableTailwindCandidate;
|
|
@@ -72,6 +74,7 @@ exports.resolveGlobalVarScanCacheDir = unplugin.resolveGlobalVarScanCacheDir;
|
|
|
72
74
|
exports.resolveNativeCacheIdentity = unplugin.resolveNativeCacheIdentity;
|
|
73
75
|
exports.rewriteGlobalVarCssAliases = unplugin.rewriteGlobalVarCssAliases;
|
|
74
76
|
exports.rollupPlugin = unplugin.rollupPlugin;
|
|
77
|
+
exports.scanCustomPropertyNames = unplugin.scanCustomPropertyNames;
|
|
75
78
|
exports.scanGlobalVarCss = unplugin.scanGlobalVarCss;
|
|
76
79
|
exports.shouldEmitWarning = unplugin.shouldEmitWarning;
|
|
77
80
|
exports.shouldTrackGlobalVarSources = unplugin.shouldTrackGlobalVarSources;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { CSSManglerOptions, CSSManglerResult, MangleMap, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.cjs';
|
|
2
2
|
export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
|
|
3
|
-
import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.
|
|
3
|
+
import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.PhOFTQpB.cjs';
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
export = undefined;
|
|
6
|
-
export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as
|
|
6
|
+
export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findLocalImportSources, I as findRSCBoundaryViolation, J as findRSCGraphViolation, K as hasInjectableTailwindCandidate, L as hasTokens, N as hasUseClientDirective, O as hasUseServerDirective, Q as isCompileSourceOptedIn, T as isHardIgnoredPath, U as isMonorepoPackage, W as isPackagesSkippedSource, X as isRSCServerModule, Y as mangleCodeClassesSync, Z as mangleHybridHazardMessage, _ as mergeThemes, $ as missingTailwindEntryMessage, a0 as normalizeGlobalVarAliasesForCache, a1 as parseThemeBlocks, a2 as recordGlobalVarSourceFile, a3 as resolveCompileSourceDirs, a4 as resolveNativeCacheIdentity, a5 as rollupPlugin, a6 as scanCustomPropertyNames, a7 as shouldEmitWarning, a8 as shouldTrackGlobalVarSources, a9 as shouldWarnMissingTailwindEntry, aa as shouldWarnUnscopedMonorepo, ab as skippedSzFilesMessage, A as unplugin, ac as unscopedMonorepoMessage, ad as vitePlugin, ae as webpackPlugin } from './shared/unplugin.PhOFTQpB.cjs';
|
|
7
7
|
import 'postcss';
|
|
8
8
|
import '@csszyx/compiler';
|
|
9
9
|
import 'esbuild';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CSSManglerOptions, CSSManglerResult, MangleMap, createPostCSSPlugin, escapeCSSClassName, mangleCSS, mangleCSSSync, unescapeTailwindClass } from './css-mangler.mjs';
|
|
2
2
|
export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
|
|
3
|
-
import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.
|
|
4
|
-
export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, A as default, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as
|
|
3
|
+
import { G as GlobalVarScanCacheKeyInput, C as CssVarScanResult, S as ScanGlobalVarCssOptions, P as PlanGlobalVarAliasesInput, a as GlobalVarAliasPlan, R as RewriteGlobalVarCssAliasesOptions, b as GlobalVarCssAliasRewriteResult, c as CreateGlobalVarAliasValidationOptionsInput, V as ValidateGlobalVarAliasInputsOptions, d as GlobalVarAliasValidationResult } from './shared/unplugin.PhOFTQpB.mjs';
|
|
4
|
+
export { e as CssVarDefinition, f as CssVarLocation, g as CssVarReference, h as GlobalVarAliasDiagnostic, i as GlobalVarAliasDiagnosticSeverity, j as GlobalVarAliasEntry, k as GlobalVarCodeSource, l as GlobalVarCssAssetSource, m as GlobalVarCssSource, n as GlobalVarScanCacheEntry, M as MangleHybridHazards, o as ParsedTheme, p as RSCBoundaryViolation, q as RSCModuleRecord, r as appendTailwindSourceDirective, s as assertNoRSCBoundaryViolation, t as assertNoRSCGraphViolation, u as collectMangleHybridHazards, v as computeSafelistRelPath, w as createGlobalVarMapAssetSource, x as createRSCModuleRecord, y as cssHasContentScope, z as cssImportsTailwind, A as default, B as deleteRSCModuleRecord, D as esbuildPlugin, E as extractGlobalVarAliasesForManifest, F as fileMayContainSafelistableSz, H as findLocalImportSources, I as findRSCBoundaryViolation, J as findRSCGraphViolation, K as hasInjectableTailwindCandidate, L as hasTokens, N as hasUseClientDirective, O as hasUseServerDirective, Q as isCompileSourceOptedIn, T as isHardIgnoredPath, U as isMonorepoPackage, W as isPackagesSkippedSource, X as isRSCServerModule, Y as mangleCodeClassesSync, Z as mangleHybridHazardMessage, _ as mergeThemes, $ as missingTailwindEntryMessage, a0 as normalizeGlobalVarAliasesForCache, a1 as parseThemeBlocks, a2 as recordGlobalVarSourceFile, a3 as resolveCompileSourceDirs, a4 as resolveNativeCacheIdentity, a5 as rollupPlugin, a6 as scanCustomPropertyNames, a7 as shouldEmitWarning, a8 as shouldTrackGlobalVarSources, a9 as shouldWarnMissingTailwindEntry, aa as shouldWarnUnscopedMonorepo, ab as skippedSzFilesMessage, A as unplugin, ac as unscopedMonorepoMessage, ad as vitePlugin, ae as webpackPlugin } from './shared/unplugin.PhOFTQpB.mjs';
|
|
5
5
|
import 'postcss';
|
|
6
6
|
import '@csszyx/compiler';
|
|
7
7
|
import 'esbuild';
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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
|
|
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 findLocalImportSources, q as findRSCBoundaryViolation, r as findRSCGraphViolation, s as hasInjectableTailwindCandidate, t as hasTokens, v as hasUseClientDirective, w as hasUseServerDirective, x as isCompileSourceOptedIn, y as isHardIgnoredPath, z as isMonorepoPackage, A as isPackagesSkippedSource, B as isRSCServerModule, C as isTailwindReservedGlobalVar, D as mangleCodeClassesSync, E as mangleHybridHazardMessage, F as mergeThemes, G as missingTailwindEntryMessage, H as normalizeGlobalVarAliasesForCache, I as parseThemeBlocks, J as planGlobalVarAliases, K as readGlobalVarScanCache, L as recordGlobalVarSourceFile, M as resolveCompileSourceDirs, N as resolveGlobalVarScanCacheDir, O as resolveNativeCacheIdentity, P as rewriteGlobalVarCssAliases, Q as rollupPlugin, R as scanCustomPropertyNames, S as scanGlobalVarCss, T as shouldEmitWarning, U as shouldTrackGlobalVarSources, V as shouldWarnMissingTailwindEntry, W as shouldWarnUnscopedMonorepo, X as skippedSzFilesMessage, u as unplugin, Y as unscopedMonorepoMessage, Z as validateGlobalVarAliasInputs, _ as vitePlugin, $ as webpackPlugin, a0 as writeGlobalVarScanCache } from './shared/unplugin.BS60onPk.mjs';
|
|
3
3
|
export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
|
|
4
4
|
import 'postcss';
|
|
5
5
|
import 'postcss-selector-parser';
|
|
6
|
+
import 'node:crypto';
|
|
6
7
|
import 'node:fs';
|
|
7
8
|
import 'node:module';
|
|
8
9
|
import 'node:path';
|
|
@@ -15,6 +16,6 @@ import '@csszyx/svelte-adapter';
|
|
|
15
16
|
import '@csszyx/vue-adapter';
|
|
16
17
|
import 'unplugin';
|
|
17
18
|
import './shared/unplugin.B1mblcm-.mjs';
|
|
18
|
-
import '
|
|
19
|
-
import './shared/unplugin.
|
|
19
|
+
import './shared/unplugin.B3RHYokB.mjs';
|
|
20
|
+
import './shared/unplugin.ByzV6iZE.mjs';
|
|
20
21
|
import 'postcss-value-parser';
|
package/dist/next-prebuild.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
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.
|
|
6
|
+
const nextTransformMetadata = require('./shared/unplugin.CBKZoxQ1.cjs');
|
|
7
7
|
const nextWatcherCycle = require('./shared/unplugin.BFN_Ueyx.cjs');
|
|
8
|
-
const transformCache = require('./shared/unplugin.
|
|
8
|
+
const transformCache = require('./shared/unplugin.D0N9bprz.cjs');
|
|
9
9
|
require('@csszyx/compiler');
|
|
10
10
|
require('./shared/unplugin.BCwRIUs_.cjs');
|
|
11
11
|
require('node:os');
|
package/dist/next-prebuild.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.
|
|
4
|
+
import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.B3cvNxnk.mjs';
|
|
5
5
|
import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.ChwZMl_w.mjs';
|
|
6
|
-
import { r as resolveTransformCacheDir } from './shared/unplugin.
|
|
6
|
+
import { r as resolveTransformCacheDir } from './shared/unplugin.ByzV6iZE.mjs';
|
|
7
7
|
import '@csszyx/compiler';
|
|
8
8
|
import './shared/unplugin.B1mblcm-.mjs';
|
|
9
9
|
import 'node:os';
|
|
@@ -5,8 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const node_crypto = require('node:crypto');
|
|
6
6
|
const path = require('node:path');
|
|
7
7
|
const nextWatcherCycle = require('./shared/unplugin.BFN_Ueyx.cjs');
|
|
8
|
-
const nextTransformMetadata = require('./shared/unplugin.
|
|
9
|
-
const
|
|
8
|
+
const nextTransformMetadata = require('./shared/unplugin.CBKZoxQ1.cjs');
|
|
9
|
+
const runtimeImportScan = require('./shared/unplugin.Rov-j_Wm.cjs');
|
|
10
|
+
const transformCache = require('./shared/unplugin.D0N9bprz.cjs');
|
|
10
11
|
require('node:fs');
|
|
11
12
|
require('node:os');
|
|
12
13
|
require('proper-lockfile');
|
|
@@ -29,18 +30,13 @@ function _interopNamespaceCompat(e) {
|
|
|
29
30
|
const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
|
|
30
31
|
|
|
31
32
|
const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
|
|
32
|
-
const RUNTIME_HELPER_IMPORT_RE = {
|
|
33
|
-
_sz: /(?:import|export)\s+\{[^{}]*\b_sz\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
|
|
34
|
-
_szMerge: /(?:import|export)\s+\{[^{}]*\b_szMerge\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
|
|
35
|
-
__szColorVar: /(?:import|export)\s+\{[^{}]*\b__szColorVar\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
|
|
36
|
-
};
|
|
37
33
|
function injectNextRuntimeImports(code, usage) {
|
|
38
34
|
const helpers = runtimeHelpersFromUsage(usage);
|
|
39
35
|
if (helpers.length === 0) {
|
|
40
36
|
return { code, injected: [] };
|
|
41
37
|
}
|
|
42
38
|
const hasRuntimeImport = code.includes("@csszyx/runtime");
|
|
43
|
-
const missing = hasRuntimeImport ? helpers.filter((helper) => !
|
|
39
|
+
const missing = hasRuntimeImport ? helpers.filter((helper) => !runtimeImportScan.importsRuntimeHelper(code, helper)) : helpers;
|
|
44
40
|
if (missing.length === 0) {
|
|
45
41
|
return { code, injected: [] };
|
|
46
42
|
}
|
|
@@ -61,6 +57,12 @@ function runtimeHelpersFromUsage(usage) {
|
|
|
61
57
|
if (usage.usesMerge) {
|
|
62
58
|
helpers.push("_szMerge");
|
|
63
59
|
}
|
|
60
|
+
if (usage.usesSzcn) {
|
|
61
|
+
helpers.push("_szcn");
|
|
62
|
+
}
|
|
63
|
+
if (usage.usesSzPart) {
|
|
64
|
+
helpers.push("_szPart");
|
|
65
|
+
}
|
|
64
66
|
if (usage.usesColorVar) {
|
|
65
67
|
helpers.push("__szColorVar");
|
|
66
68
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
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.
|
|
5
|
-
import {
|
|
4
|
+
import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.B3cvNxnk.mjs';
|
|
5
|
+
import { i as importsRuntimeHelper } from './shared/unplugin.B3RHYokB.mjs';
|
|
6
|
+
import { r as resolveTransformCacheDir } from './shared/unplugin.ByzV6iZE.mjs';
|
|
6
7
|
import 'node:fs';
|
|
7
8
|
import 'node:os';
|
|
8
9
|
import 'proper-lockfile';
|
|
@@ -10,18 +11,13 @@ import './shared/unplugin.B1mblcm-.mjs';
|
|
|
10
11
|
import '@csszyx/compiler';
|
|
11
12
|
|
|
12
13
|
const DIRECTIVE_PROLOGUE_PREFIX_RE = /^((?:\s|\/\/[^\n]*\n|\/\*(?:[^*]|\*(?!\/))*\*\/)*)(['"]use (?:client|server)['"];?\s*)/;
|
|
13
|
-
const RUNTIME_HELPER_IMPORT_RE = {
|
|
14
|
-
_sz: /(?:import|export)\s+\{[^{}]*\b_sz\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
|
|
15
|
-
_szMerge: /(?:import|export)\s+\{[^{}]*\b_szMerge\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/,
|
|
16
|
-
__szColorVar: /(?:import|export)\s+\{[^{}]*\b__szColorVar\b[^{}]*\}\s*from\s*['"]@csszyx\/runtime['"]/
|
|
17
|
-
};
|
|
18
14
|
function injectNextRuntimeImports(code, usage) {
|
|
19
15
|
const helpers = runtimeHelpersFromUsage(usage);
|
|
20
16
|
if (helpers.length === 0) {
|
|
21
17
|
return { code, injected: [] };
|
|
22
18
|
}
|
|
23
19
|
const hasRuntimeImport = code.includes("@csszyx/runtime");
|
|
24
|
-
const missing = hasRuntimeImport ? helpers.filter((helper) => !
|
|
20
|
+
const missing = hasRuntimeImport ? helpers.filter((helper) => !importsRuntimeHelper(code, helper)) : helpers;
|
|
25
21
|
if (missing.length === 0) {
|
|
26
22
|
return { code, injected: [] };
|
|
27
23
|
}
|
|
@@ -42,6 +38,12 @@ function runtimeHelpersFromUsage(usage) {
|
|
|
42
38
|
if (usage.usesMerge) {
|
|
43
39
|
helpers.push("_szMerge");
|
|
44
40
|
}
|
|
41
|
+
if (usage.usesSzcn) {
|
|
42
|
+
helpers.push("_szcn");
|
|
43
|
+
}
|
|
44
|
+
if (usage.usesSzPart) {
|
|
45
|
+
helpers.push("_szPart");
|
|
46
|
+
}
|
|
45
47
|
if (usage.usesColorVar) {
|
|
46
48
|
helpers.push("__szColorVar");
|
|
47
49
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const RUNTIME_IMPORT_CLAUSE_RE = /(?:import|export)\s+\{([^{}]*)\}\s*from\s*['"]@csszyx\/runtime['"]/g;
|
|
2
|
+
function clauseNames(clauseBody) {
|
|
3
|
+
const names = [];
|
|
4
|
+
for (const part of clauseBody.split(",")) {
|
|
5
|
+
const trimmed = part.trim();
|
|
6
|
+
if (!trimmed) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
const spaceAt = trimmed.search(/\s/);
|
|
10
|
+
names.push(spaceAt === -1 ? trimmed : trimmed.slice(0, spaceAt));
|
|
11
|
+
}
|
|
12
|
+
return names;
|
|
13
|
+
}
|
|
14
|
+
function importsRuntimeHelper(code, helper) {
|
|
15
|
+
RUNTIME_IMPORT_CLAUSE_RE.lastIndex = 0;
|
|
16
|
+
for (let match = RUNTIME_IMPORT_CLAUSE_RE.exec(code); match; match = RUNTIME_IMPORT_CLAUSE_RE.exec(code)) {
|
|
17
|
+
if (clauseNames(match[1]).includes(helper)) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const RUNTIME_IMPORT_APPEND_RE = /(import\s+\{[^{}]*)\}\s*from\s*['"]@csszyx\/runtime['"]/;
|
|
24
|
+
function findRuntimeImportClause(code) {
|
|
25
|
+
const match = RUNTIME_IMPORT_APPEND_RE.exec(code);
|
|
26
|
+
return match ? { statement: match[0], prefixWithBody: match[1] } : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { findRuntimeImportClause as f, importsRuntimeHelper as i };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { ensureRustTransformAvailable, transformSourceCode, transformRust, transformOxc, transform } from '@csszyx/compiler';
|
|
3
|
-
import { c as createTransformCacheKey, a as readTransformCache, w as writeTransformCache } from './unplugin.
|
|
3
|
+
import { c as createTransformCacheKey, a as readTransformCache, w as writeTransformCache } from './unplugin.ByzV6iZE.mjs';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
import { s as sortStrings } from './unplugin.B1mblcm-.mjs';
|
|
6
6
|
|