@csszyx/unplugin 0.11.10 → 0.12.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/README.md +1 -1
- package/dist/index.cjs +7 -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 +4 -52
- package/dist/next-turbo-loader.mjs +3 -51
- package/dist/shared/{unplugin.CVMbUfH5.mjs → unplugin.B9vpjOhD.mjs} +310 -52
- package/dist/shared/{unplugin.CRuVOB4Q.cjs → unplugin.BK3XVHe8.cjs} +314 -53
- package/dist/shared/{unplugin.BZq6FKn2.cjs → unplugin.Bb5TeU9B.cjs} +1 -1
- package/dist/shared/unplugin.C2lHQFii.cjs +114 -0
- package/dist/shared/unplugin.CBMJufQ8.mjs +108 -0
- package/dist/shared/{unplugin.fOnGXWgS.mjs → unplugin.CDqY7kmk.mjs} +8 -1
- package/dist/shared/{unplugin.CjCKWnoX.d.cts → unplugin.CtnKJhAi.d.cts} +32 -1
- package/dist/shared/{unplugin.CjCKWnoX.d.mts → unplugin.CtnKJhAi.d.mts} +32 -1
- package/dist/shared/{unplugin.-yLpX1Ck.mjs → unplugin.DXgxFHzO.mjs} +1 -1
- package/dist/shared/{unplugin.CKIOVNOg.cjs → unplugin.DbZ7tCfN.cjs} +8 -1
- package/dist/vite.cjs +4 -3
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +4 -3
- package/dist/webpack.cjs +4 -3
- package/dist/webpack.d.cts +2 -2
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.mjs +4 -3
- package/package.json +13 -11
- package/dist/shared/unplugin.Cnxm1DcC.cjs +0 -53
- package/dist/shared/unplugin.Lhzkcj-A.mjs +0 -49
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Vite, Webpack, and esbuild integration for CSSzyx.
|
|
4
4
|
|
|
5
|
-
Build-time plugin that transforms `sz` props into Tailwind classes, generates static CSS, mangles class names in production, and injects hydration scripts for SSR.
|
|
5
|
+
Build-time plugin that transforms `sz` props into Tailwind classes, generates static CSS, optionally mangles class names in production (opt-in), and injects hydration scripts for SSR.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
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.
|
|
6
|
+
const unplugin = require('./shared/unplugin.BK3XVHe8.cjs');
|
|
7
7
|
const types = require('@csszyx/types');
|
|
8
8
|
require('postcss');
|
|
9
9
|
require('postcss-selector-parser');
|
|
@@ -19,9 +19,10 @@ require('@csszyx/core/native');
|
|
|
19
19
|
require('@csszyx/svelte-adapter');
|
|
20
20
|
require('@csszyx/vue-adapter');
|
|
21
21
|
require('unplugin');
|
|
22
|
-
require('./shared/unplugin.
|
|
23
|
-
require('./shared/unplugin.
|
|
22
|
+
require('./shared/unplugin.DbZ7tCfN.cjs');
|
|
23
|
+
require('./shared/unplugin.C2lHQFii.cjs');
|
|
24
24
|
require('./shared/unplugin.BkRah5Ot.cjs');
|
|
25
|
+
require('node:zlib');
|
|
25
26
|
require('postcss-value-parser');
|
|
26
27
|
|
|
27
28
|
|
|
@@ -31,6 +32,7 @@ exports.escapeCSSClassName = cssMangler.escapeCSSClassName;
|
|
|
31
32
|
exports.mangleCSS = cssMangler.mangleCSS;
|
|
32
33
|
exports.mangleCSSSync = cssMangler.mangleCSSSync;
|
|
33
34
|
exports.unescapeTailwindClass = cssMangler.unescapeTailwindClass;
|
|
35
|
+
exports.allocateMangleTokens = unplugin.allocateMangleTokens;
|
|
34
36
|
exports.appendTailwindSourceDirective = unplugin.appendTailwindSourceDirective;
|
|
35
37
|
exports.assertNoRSCBoundaryViolation = unplugin.assertNoRSCBoundaryViolation;
|
|
36
38
|
exports.assertNoRSCGraphViolation = unplugin.assertNoRSCGraphViolation;
|
|
@@ -44,6 +46,7 @@ exports.cssHasContentScope = unplugin.cssHasContentScope;
|
|
|
44
46
|
exports.cssImportsTailwind = unplugin.cssImportsTailwind;
|
|
45
47
|
exports.default = unplugin.unplugin;
|
|
46
48
|
exports.deleteRSCModuleRecord = unplugin.deleteRSCModuleRecord;
|
|
49
|
+
exports.emitMissingCssFallback = unplugin.emitMissingCssFallback;
|
|
47
50
|
exports.esbuildPlugin = unplugin.esbuildPlugin;
|
|
48
51
|
exports.extractGlobalVarAliasesForManifest = unplugin.extractGlobalVarAliasesForManifest;
|
|
49
52
|
exports.fileMayContainSafelistableSz = unplugin.fileMayContainSafelistableSz;
|
|
@@ -77,6 +80,7 @@ exports.rewriteGlobalVarCssAliases = unplugin.rewriteGlobalVarCssAliases;
|
|
|
77
80
|
exports.rollupPlugin = unplugin.rollupPlugin;
|
|
78
81
|
exports.scanCustomPropertyNames = unplugin.scanCustomPropertyNames;
|
|
79
82
|
exports.scanGlobalVarCss = unplugin.scanGlobalVarCss;
|
|
83
|
+
exports.shouldEmitMissingCssFallback = unplugin.shouldEmitMissingCssFallback;
|
|
80
84
|
exports.shouldEmitWarning = unplugin.shouldEmitWarning;
|
|
81
85
|
exports.shouldTrackGlobalVarSources = unplugin.shouldTrackGlobalVarSources;
|
|
82
86
|
exports.shouldWarnMissingTailwindEntry = unplugin.shouldWarnMissingTailwindEntry;
|
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.CtnKJhAi.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
|
|
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 allocateMangleTokens, s as appendTailwindSourceDirective, t as assertNoRSCBoundaryViolation, u as assertNoRSCGraphViolation, v as collectMangleHybridHazards, w as computeSafelistRelPath, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, A as cssImportsTailwind, D as deleteRSCModuleRecord, E as emitMissingCssFallback, F as esbuildPlugin, H as extractGlobalVarAliasesForManifest, I as fileMayContainSafelistableSz, J as findLocalImportSources, K as findRSCBoundaryViolation, L as findRSCGraphViolation, N as hasInjectableTailwindCandidate, O as hasTokens, Q as hasUseClientDirective, T as hasUseServerDirective, U as isCompileSourceOptedIn, W as isHardIgnoredPath, X as isMonorepoPackage, Y as isPackagesSkippedSource, Z as isRSCServerModule, _ as mangleCodeClassesSync, $ as mangleEligibleClasses, a0 as mangleHybridHazardMessage, a1 as mergeThemes, a2 as missingTailwindEntryMessage, a3 as normalizeGlobalVarAliasesForCache, a4 as parseThemeBlocks, a5 as recordGlobalVarSourceFile, a6 as resolveCompileSourceDirs, a7 as resolveNativeCacheIdentity, a8 as rollupPlugin, a9 as scanCustomPropertyNames, aa as shouldEmitMissingCssFallback, ab as shouldEmitWarning, ac as shouldTrackGlobalVarSources, ad as shouldWarnMissingTailwindEntry, ae as shouldWarnUnscopedMonorepo, af as skippedSzFilesMessage, B as unplugin, ag as unscopedMonorepoMessage, ah as vitePlugin, ai as webpackPlugin } from './shared/unplugin.CtnKJhAi.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
|
|
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.CtnKJhAi.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 allocateMangleTokens, s as appendTailwindSourceDirective, t as assertNoRSCBoundaryViolation, u as assertNoRSCGraphViolation, v as collectMangleHybridHazards, w as computeSafelistRelPath, x as createGlobalVarMapAssetSource, y as createRSCModuleRecord, z as cssHasContentScope, A as cssImportsTailwind, B as default, D as deleteRSCModuleRecord, E as emitMissingCssFallback, F as esbuildPlugin, H as extractGlobalVarAliasesForManifest, I as fileMayContainSafelistableSz, J as findLocalImportSources, K as findRSCBoundaryViolation, L as findRSCGraphViolation, N as hasInjectableTailwindCandidate, O as hasTokens, Q as hasUseClientDirective, T as hasUseServerDirective, U as isCompileSourceOptedIn, W as isHardIgnoredPath, X as isMonorepoPackage, Y as isPackagesSkippedSource, Z as isRSCServerModule, _ as mangleCodeClassesSync, $ as mangleEligibleClasses, a0 as mangleHybridHazardMessage, a1 as mergeThemes, a2 as missingTailwindEntryMessage, a3 as normalizeGlobalVarAliasesForCache, a4 as parseThemeBlocks, a5 as recordGlobalVarSourceFile, a6 as resolveCompileSourceDirs, a7 as resolveNativeCacheIdentity, a8 as rollupPlugin, a9 as scanCustomPropertyNames, aa as shouldEmitMissingCssFallback, ab as shouldEmitWarning, ac as shouldTrackGlobalVarSources, ad as shouldWarnMissingTailwindEntry, ae as shouldWarnUnscopedMonorepo, af as skippedSzFilesMessage, B as unplugin, ag as unscopedMonorepoMessage, ah as vitePlugin, ai as webpackPlugin } from './shared/unplugin.CtnKJhAi.mjs';
|
|
5
5
|
import 'postcss';
|
|
6
6
|
import '@csszyx/compiler';
|
|
7
7
|
import 'esbuild';
|
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
|
|
2
|
+
export { a as allocateMangleTokens, b as appendTailwindSourceDirective, c as assertNoRSCBoundaryViolation, d as assertNoRSCGraphViolation, e as collectMangleHybridHazards, f as computeSafelistRelPath, g as createGlobalVarAliasValidationOptions, h as createGlobalVarMapAssetSource, i as createGlobalVarScanCacheKey, j as createRSCModuleRecord, k as cssHasContentScope, l as cssImportsTailwind, u as default, m as deleteRSCModuleRecord, n as emitMissingCssFallback, o as esbuildPlugin, p as extractGlobalVarAliasesForManifest, q as fileMayContainSafelistableSz, r as findLocalImportSources, s as findRSCBoundaryViolation, t as findRSCGraphViolation, v as hasInjectableTailwindCandidate, w as hasTokens, x as hasUseClientDirective, y as hasUseServerDirective, z as isCompileSourceOptedIn, A as isHardIgnoredPath, B as isMonorepoPackage, C as isPackagesSkippedSource, D as isRSCServerModule, E as isTailwindReservedGlobalVar, F as mangleCodeClassesSync, G as mangleEligibleClasses, H as mangleHybridHazardMessage, I as mergeThemes, J as missingTailwindEntryMessage, K as normalizeGlobalVarAliasesForCache, L as parseThemeBlocks, M as planGlobalVarAliases, N as readGlobalVarScanCache, O as recordGlobalVarSourceFile, P as resolveCompileSourceDirs, Q as resolveGlobalVarScanCacheDir, R as resolveNativeCacheIdentity, S as rewriteGlobalVarCssAliases, T as rollupPlugin, U as scanCustomPropertyNames, V as scanGlobalVarCss, W as shouldEmitMissingCssFallback, X as shouldEmitWarning, Y as shouldTrackGlobalVarSources, Z as shouldWarnMissingTailwindEntry, _ as shouldWarnUnscopedMonorepo, $ as skippedSzFilesMessage, u as unplugin, a0 as unscopedMonorepoMessage, a1 as validateGlobalVarAliasInputs, a2 as vitePlugin, a3 as webpackPlugin, a4 as writeGlobalVarScanCache } from './shared/unplugin.B9vpjOhD.mjs';
|
|
3
3
|
export { CSSZYX_GLOBAL_ALIAS_PREFIX, TAILWIND_RESERVED_PREFIXES } from '@csszyx/types';
|
|
4
4
|
import 'postcss';
|
|
5
5
|
import 'postcss-selector-parser';
|
|
@@ -15,7 +15,8 @@ import '@csszyx/core/native';
|
|
|
15
15
|
import '@csszyx/svelte-adapter';
|
|
16
16
|
import '@csszyx/vue-adapter';
|
|
17
17
|
import 'unplugin';
|
|
18
|
-
import './shared/unplugin.
|
|
19
|
-
import './shared/unplugin.
|
|
18
|
+
import './shared/unplugin.CDqY7kmk.mjs';
|
|
19
|
+
import './shared/unplugin.CBMJufQ8.mjs';
|
|
20
20
|
import './shared/unplugin.B3XoSRB8.mjs';
|
|
21
|
+
import 'node:zlib';
|
|
21
22
|
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.Bb5TeU9B.cjs');
|
|
7
7
|
const nextWatcherCycle = require('./shared/unplugin.DblMogcN.cjs');
|
|
8
|
-
const transformCache = require('./shared/unplugin.
|
|
8
|
+
const transformCache = require('./shared/unplugin.DbZ7tCfN.cjs');
|
|
9
9
|
require('@csszyx/compiler');
|
|
10
10
|
require('./shared/unplugin.BkRah5Ot.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.DXgxFHzO.mjs';
|
|
5
5
|
import { c as createNextStateContext, w as writeNextSafelistShard, r as runNextWatcherCycle } from './shared/unplugin.DMcbmP01.mjs';
|
|
6
|
-
import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.
|
|
6
|
+
import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.CDqY7kmk.mjs';
|
|
7
7
|
import '@csszyx/compiler';
|
|
8
8
|
import './shared/unplugin.B3XoSRB8.mjs';
|
|
9
9
|
import 'node:os';
|
|
@@ -5,9 +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.DblMogcN.cjs');
|
|
8
|
-
const nextTransformMetadata = require('./shared/unplugin.
|
|
9
|
-
const
|
|
10
|
-
const transformCache = require('./shared/unplugin.
|
|
8
|
+
const nextTransformMetadata = require('./shared/unplugin.Bb5TeU9B.cjs');
|
|
9
|
+
const nextRuntimeInjection = require('./shared/unplugin.C2lHQFii.cjs');
|
|
10
|
+
const transformCache = require('./shared/unplugin.DbZ7tCfN.cjs');
|
|
11
11
|
require('node:fs');
|
|
12
12
|
require('node:os');
|
|
13
13
|
require('proper-lockfile');
|
|
@@ -29,54 +29,6 @@ function _interopNamespaceCompat(e) {
|
|
|
29
29
|
|
|
30
30
|
const path__namespace = /*#__PURE__*/_interopNamespaceCompat(path);
|
|
31
31
|
|
|
32
|
-
function injectNextRuntimeImports(code, usage) {
|
|
33
|
-
const helpers = runtimeHelpersFromUsage(usage);
|
|
34
|
-
if (helpers.length === 0) {
|
|
35
|
-
return { code, injected: [] };
|
|
36
|
-
}
|
|
37
|
-
const hasRuntimeImport = code.includes("@csszyx/runtime");
|
|
38
|
-
const missing = hasRuntimeImport ? helpers.filter((helper) => !runtimeImportScan.importsRuntimeHelper(code, helper)) : helpers;
|
|
39
|
-
if (missing.length === 0) {
|
|
40
|
-
return { code, injected: [] };
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
code: insertRuntimeImport(
|
|
44
|
-
code,
|
|
45
|
-
`import { ${missing.join(", ")} } from '@csszyx/runtime';
|
|
46
|
-
`
|
|
47
|
-
),
|
|
48
|
-
injected: missing
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function runtimeHelpersFromUsage(usage) {
|
|
52
|
-
const helpers = [];
|
|
53
|
-
if (usage.usesRuntime) {
|
|
54
|
-
helpers.push("_sz");
|
|
55
|
-
}
|
|
56
|
-
if (usage.usesMerge) {
|
|
57
|
-
helpers.push("_szMerge");
|
|
58
|
-
}
|
|
59
|
-
if (usage.usesSzcn) {
|
|
60
|
-
helpers.push("_szcn");
|
|
61
|
-
}
|
|
62
|
-
if (usage.usesSzPart) {
|
|
63
|
-
helpers.push("_szPart");
|
|
64
|
-
}
|
|
65
|
-
if (usage.usesColorVar) {
|
|
66
|
-
helpers.push("__szColorVar");
|
|
67
|
-
}
|
|
68
|
-
if (usage.usesSpacingVar) {
|
|
69
|
-
helpers.push("__szSpacingVar");
|
|
70
|
-
}
|
|
71
|
-
if (usage.usesUnitVar) {
|
|
72
|
-
helpers.push("__szUnitVar");
|
|
73
|
-
}
|
|
74
|
-
return helpers;
|
|
75
|
-
}
|
|
76
|
-
function insertRuntimeImport(code, importStmt) {
|
|
77
|
-
return runtimeImportScan.insertAfterUseDirective(code, importStmt);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
32
|
function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
|
|
81
33
|
const options = normalizeOptions(loaderContext, explicitOptions);
|
|
82
34
|
assertTurbopackMangleBoundary(options, loaderContext.resourcePath);
|
|
@@ -109,7 +61,7 @@ function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
|
|
|
109
61
|
astBudget: options.astBudget,
|
|
110
62
|
allowBabelFallback: options.allowBabelFallback
|
|
111
63
|
});
|
|
112
|
-
const injected = injectNextRuntimeImports(transform.result.code, transform.result);
|
|
64
|
+
const injected = nextRuntimeInjection.injectNextRuntimeImports(transform.result.code, transform.result);
|
|
113
65
|
const metadata = nextTransformMetadata.collectNextTransformMetadata(
|
|
114
66
|
transform.result,
|
|
115
67
|
source,
|
|
@@ -1,63 +1,15 @@
|
|
|
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.DMcbmP01.mjs';
|
|
4
|
-
import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin
|
|
5
|
-
import { i as
|
|
6
|
-
import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.
|
|
4
|
+
import { r as readPackageVersion, t as transformNextSource, c as collectNextTransformMetadata, a as createNextSafelistShardFromMetadata } from './shared/unplugin.DXgxFHzO.mjs';
|
|
5
|
+
import { i as injectNextRuntimeImports } from './shared/unplugin.CBMJufQ8.mjs';
|
|
6
|
+
import { r as resolveTransformCacheDir, n as normalizePathSeparators } from './shared/unplugin.CDqY7kmk.mjs';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import 'node:os';
|
|
9
9
|
import 'proper-lockfile';
|
|
10
10
|
import './shared/unplugin.B3XoSRB8.mjs';
|
|
11
11
|
import '@csszyx/compiler';
|
|
12
12
|
|
|
13
|
-
function injectNextRuntimeImports(code, usage) {
|
|
14
|
-
const helpers = runtimeHelpersFromUsage(usage);
|
|
15
|
-
if (helpers.length === 0) {
|
|
16
|
-
return { code, injected: [] };
|
|
17
|
-
}
|
|
18
|
-
const hasRuntimeImport = code.includes("@csszyx/runtime");
|
|
19
|
-
const missing = hasRuntimeImport ? helpers.filter((helper) => !importsRuntimeHelper(code, helper)) : helpers;
|
|
20
|
-
if (missing.length === 0) {
|
|
21
|
-
return { code, injected: [] };
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
code: insertRuntimeImport(
|
|
25
|
-
code,
|
|
26
|
-
`import { ${missing.join(", ")} } from '@csszyx/runtime';
|
|
27
|
-
`
|
|
28
|
-
),
|
|
29
|
-
injected: missing
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function runtimeHelpersFromUsage(usage) {
|
|
33
|
-
const helpers = [];
|
|
34
|
-
if (usage.usesRuntime) {
|
|
35
|
-
helpers.push("_sz");
|
|
36
|
-
}
|
|
37
|
-
if (usage.usesMerge) {
|
|
38
|
-
helpers.push("_szMerge");
|
|
39
|
-
}
|
|
40
|
-
if (usage.usesSzcn) {
|
|
41
|
-
helpers.push("_szcn");
|
|
42
|
-
}
|
|
43
|
-
if (usage.usesSzPart) {
|
|
44
|
-
helpers.push("_szPart");
|
|
45
|
-
}
|
|
46
|
-
if (usage.usesColorVar) {
|
|
47
|
-
helpers.push("__szColorVar");
|
|
48
|
-
}
|
|
49
|
-
if (usage.usesSpacingVar) {
|
|
50
|
-
helpers.push("__szSpacingVar");
|
|
51
|
-
}
|
|
52
|
-
if (usage.usesUnitVar) {
|
|
53
|
-
helpers.push("__szUnitVar");
|
|
54
|
-
}
|
|
55
|
-
return helpers;
|
|
56
|
-
}
|
|
57
|
-
function insertRuntimeImport(code, importStmt) {
|
|
58
|
-
return insertAfterUseDirective(code, importStmt);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
13
|
function runNextTurboLoader(source, loaderContext, explicitOptions = {}) {
|
|
62
14
|
const options = normalizeOptions(loaderContext, explicitOptions);
|
|
63
15
|
assertTurbopackMangleBoundary(options, loaderContext.resourcePath);
|