@animus-ui/next-plugin 0.1.23 → 0.1.25
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 +40 -5
- package/dist/index.mjs +41 -6
- package/dist/{loader-core-Cnipfewg.cjs → loader-core-CAr8opFH.cjs} +3 -2
- package/dist/{loader-core-Dg0a-jZv.mjs → loader-core-pACpByOT.mjs} +3 -2
- package/dist/loader-core.d.ts +3 -0
- package/dist/loader-core.d.ts.map +1 -1
- package/dist/loader.cjs +1 -1
- package/dist/loader.mjs +1 -1
- package/dist/plugin.d.ts +9 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/{turbopack-config-BIshjC09.mjs → turbopack-config-BdfqxwT0.mjs} +20 -2
- package/dist/{turbopack-config-BnLYDcu9.cjs → turbopack-config-D-6BRBYi.cjs} +24 -0
- package/dist/turbopack-config.d.ts +9 -0
- package/dist/turbopack-config.d.ts.map +1 -1
- package/dist/turbopack-loader.cjs +2 -2
- package/dist/turbopack-loader.mjs +2 -2
- package/dist/types.d.ts +13 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/with-animus.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_turbopack_config = require("./turbopack-config-
|
|
2
|
+
const require_turbopack_config = require("./turbopack-config-D-6BRBYi.cjs");
|
|
3
3
|
let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
|
|
4
4
|
let _animus_ui_extract_session = require("@animus-ui/extract/session");
|
|
5
5
|
let fs = require("fs");
|
|
@@ -23,11 +23,14 @@ var AnimusWebpackPlugin = class {
|
|
|
23
23
|
/** This turn's rejected analysis. A rejection must fail the compilation,
|
|
24
24
|
* never `watchRun`: webpack stops watching after a failed `watchRun`. */
|
|
25
25
|
watchFailure = null;
|
|
26
|
-
|
|
26
|
+
/** `development` is `next dev`: an error-level diagnostic reports and the
|
|
27
|
+
* compilation keeps publishing, whatever the emission mode. */
|
|
28
|
+
constructor(options, { development = false } = {}) {
|
|
27
29
|
this.options = options;
|
|
28
30
|
(0, _animus_ui_extract_pipeline.assertNoRetiredEngineSelection)(options.engine);
|
|
29
31
|
(0, _animus_ui_extract_session.setSharedEngine)(options.engine ?? "v2");
|
|
30
32
|
this.session = new _animus_ui_extract_session.ExtractionSession(options);
|
|
33
|
+
this.session.development = development;
|
|
31
34
|
this.session.systemPropsModuleId = _animus_ui_extract_session.TURBOPACK_SYSTEM_PROPS_ID;
|
|
32
35
|
this.animusLoaderPaths = /* @__PURE__ */ new Set([require_turbopack_config.resolveAnimusLoaderPath()]);
|
|
33
36
|
if (options.loaderPath) this.animusLoaderPaths.add(options.loaderPath);
|
|
@@ -51,6 +54,12 @@ var AnimusWebpackPlugin = class {
|
|
|
51
54
|
else if (ignored instanceof RegExp) watchOptions.ignored = (path) => path === epochPath || ignored.test(path);
|
|
52
55
|
else if (isWatchIgnoreMatcher(ignored)) watchOptions.ignored = (path) => path === epochPath || Boolean(ignored(path));
|
|
53
56
|
}
|
|
57
|
+
/** Webpack's export conditions select the system's kit files as they
|
|
58
|
+
* select the bundle's; `...`, webpack's own defaults, names none. */
|
|
59
|
+
extractConditions(compiler) {
|
|
60
|
+
const names = compiler.options?.resolve?.conditionNames ?? [];
|
|
61
|
+
this.session.conditions = names.filter((name) => name !== "...");
|
|
62
|
+
}
|
|
54
63
|
extractAliases(compiler) {
|
|
55
64
|
if (this.aliasesExtracted) return;
|
|
56
65
|
this.aliasesExtracted = true;
|
|
@@ -121,6 +130,7 @@ var AnimusWebpackPlugin = class {
|
|
|
121
130
|
compiler.hooks.run.tapPromise(PLUGIN_NAME, async (_compiler) => {
|
|
122
131
|
this.adoptCompilerContext(_compiler);
|
|
123
132
|
this.extractAliases(_compiler);
|
|
133
|
+
this.extractConditions(_compiler);
|
|
124
134
|
const existing = (0, _animus_ui_extract_session.getAnalysisStartedPromise)();
|
|
125
135
|
if (existing) {
|
|
126
136
|
await existing;
|
|
@@ -133,6 +143,7 @@ var AnimusWebpackPlugin = class {
|
|
|
133
143
|
compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, async (_compiler) => {
|
|
134
144
|
this.adoptCompilerContext(_compiler);
|
|
135
145
|
this.extractAliases(_compiler);
|
|
146
|
+
this.extractConditions(_compiler);
|
|
136
147
|
try {
|
|
137
148
|
await this.analyzeWatchTurn(_compiler);
|
|
138
149
|
this.watchFailure = null;
|
|
@@ -241,7 +252,8 @@ function withAnimus(options) {
|
|
|
241
252
|
warnedUnstableTurbopack = true;
|
|
242
253
|
console.warn("[animus-extract] `unstable_turbopack` is deprecated — rename it to `turbopack` (same shape)");
|
|
243
254
|
}
|
|
244
|
-
return (
|
|
255
|
+
return (authoredConfig) => {
|
|
256
|
+
const nextConfig = withSourceKits(authoredConfig, process.cwd());
|
|
245
257
|
if (require_turbopack_config.resolveTurbopackMode(options)) return turbopackConfig(nextConfig, options);
|
|
246
258
|
const existingWebpack = nextConfig.webpack;
|
|
247
259
|
return {
|
|
@@ -253,7 +265,7 @@ function withAnimus(options) {
|
|
|
253
265
|
const plugin = new AnimusWebpackPlugin({
|
|
254
266
|
...options,
|
|
255
267
|
mode
|
|
256
|
-
});
|
|
268
|
+
}, { development: context.dev === true });
|
|
257
269
|
plugin.setRootDir(rootDir);
|
|
258
270
|
const sessionDir = plugin.sessionDir;
|
|
259
271
|
if (!(0, fs.existsSync)(sessionDir)) (0, fs.mkdirSync)(sessionDir, { recursive: true });
|
|
@@ -301,7 +313,13 @@ function withAnimus(options) {
|
|
|
301
313
|
nmf.hooks.afterResolve.tap("AnimusVirtualResolve", (resolveData) => {
|
|
302
314
|
const sideEffects = redirectSideEffects.get(resolveData);
|
|
303
315
|
const settings = resolveData.createData?.settings;
|
|
304
|
-
if (
|
|
316
|
+
if (!settings) return;
|
|
317
|
+
if (sideEffects !== void 0) {
|
|
318
|
+
settings.sideEffects = sideEffects;
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const resource = resolveData.createData?.resource;
|
|
322
|
+
if (resource !== void 0 && (0, _animus_ui_extract_pipeline.keepsKitSourceEffects)(resource, plugin.getExternalPackageDirs())) settings.sideEffects = true;
|
|
305
323
|
});
|
|
306
324
|
});
|
|
307
325
|
} });
|
|
@@ -319,6 +337,7 @@ function withAnimus(options) {
|
|
|
319
337
|
loader: actualLoaderPath,
|
|
320
338
|
options: {
|
|
321
339
|
strict: options.strict,
|
|
340
|
+
development: context.dev === true,
|
|
322
341
|
cssImportTarget: options.cssImportTarget
|
|
323
342
|
}
|
|
324
343
|
}]
|
|
@@ -335,6 +354,20 @@ function bindTurbopackWatchDeathReport(outcome, rootDir) {
|
|
|
335
354
|
console.error(`[animus-extract] dev watcher for ${rootDir} died — source edits are no longer extracted; restart the dev server`);
|
|
336
355
|
};
|
|
337
356
|
}
|
|
357
|
+
/** The config with the source kits the app depends on added to
|
|
358
|
+
* `transpilePackages`. The kit redirect points both bundles at a kit's
|
|
359
|
+
* source, but Next's server keeps an installed package external, and so
|
|
360
|
+
* loads its runtime entry, unless the package is transpiled; transpiling
|
|
361
|
+
* also compiles its TypeScript source. */
|
|
362
|
+
function withSourceKits(nextConfig, rootDir) {
|
|
363
|
+
const declared = nextConfig.transpilePackages ?? [];
|
|
364
|
+
const kits = (0, _animus_ui_extract_pipeline.sourceKitDependencies)(rootDir).map((kit) => kit.name).filter((name) => !declared.includes(name));
|
|
365
|
+
if (kits.length === 0) return nextConfig;
|
|
366
|
+
return {
|
|
367
|
+
...nextConfig,
|
|
368
|
+
transpilePackages: [...declared, ...kits]
|
|
369
|
+
};
|
|
370
|
+
}
|
|
338
371
|
function turbopackConfig(nextConfig, options) {
|
|
339
372
|
const load = (phase) => loadTurbopackFragment(options, phase).then((fragment) => mergeTurbopackFragment(nextConfig, fragment));
|
|
340
373
|
function then(onResolved, onRejected) {
|
|
@@ -378,6 +411,7 @@ async function analyzeForTurbopack(options, phase, rootDir) {
|
|
|
378
411
|
liveTurbopackWatcher?.close();
|
|
379
412
|
liveTurbopackWatcher = null;
|
|
380
413
|
liveTurbopackSession = session;
|
|
414
|
+
session.development = development;
|
|
381
415
|
session.rootDir = rootDir;
|
|
382
416
|
const aliasPairs = (0, _animus_ui_extract_pipeline.readTsconfigAliasPairs)(rootDir);
|
|
383
417
|
const builtAliases = (0, _animus_ui_extract_pipeline.buildPathAliasesJson)(aliasPairs, rootDir);
|
|
@@ -388,6 +422,7 @@ async function analyzeForTurbopack(options, phase, rootDir) {
|
|
|
388
422
|
bindTurbopackWatchDeathReport(outcome, rootDir);
|
|
389
423
|
if (outcome.kind === "started") liveTurbopackWatcher = outcome.handle;
|
|
390
424
|
}
|
|
425
|
+
for (const line of require_turbopack_config.turbopackSideEffectsLimits(rootDir, session.externalSourceEntries, session.externalSourceSideEffects)) console.warn(line);
|
|
391
426
|
return require_turbopack_config.buildTurbopackConfig({
|
|
392
427
|
rootDir,
|
|
393
428
|
loaderPath: require_turbopack_config.resolveTurbopackLoaderPath(__dirname$1),
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as resolveTurbopackMode, i as resolveTurbopackLoaderPath, n as buildTurbopackConfig, o as
|
|
2
|
-
import { assembleStylesheet, assertKnownOptionKeys, assertNoRetiredEngineSelection, buildPathAliasesJson, isEngineTransformExtension, isPathWithinRoot, readTsconfigAliasPairs, resolveMode } from "@animus-ui/extract/pipeline";
|
|
1
|
+
import { a as resolveTurbopackMode, i as resolveTurbopackLoaderPath, n as buildTurbopackConfig, o as turbopackSideEffectsLimits, r as isTurbopackDevelopment, s as resolveAnimusLoaderPath, t as ANIMUS_TURBOPACK_RULE_GLOB } from "./turbopack-config-BdfqxwT0.mjs";
|
|
2
|
+
import { assembleStylesheet, assertKnownOptionKeys, assertNoRetiredEngineSelection, buildPathAliasesJson, isEngineTransformExtension, isPathWithinRoot, keepsKitSourceEffects, readTsconfigAliasPairs, resolveMode, sourceKitDependencies } from "@animus-ui/extract/pipeline";
|
|
3
3
|
import { ANIMUS_CSS_MODULE_ID, ANIMUS_CSS_MODULE_ID as ANIMUS_CSS_MODULE_ID$1, ExtractionSession, TURBOPACK_SYSTEM_PROPS_ID, getAnalysisStartedPromise, getReplacementEpoch, getSharedCss, getSharedExternalDirs, getSharedExternalEntries, getSharedExternalSideEffects, replacementEpochPath, resetAnalysisStartedPromise, runSessionPipeline, sessionArtifactDir, setAnalysisStartedPromise, setSharedEngine, startTurbopackWatcher, stylesPath, systemPropsPath } from "@animus-ui/extract/session";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
5
5
|
import { dirname, join } from "path";
|
|
@@ -22,11 +22,14 @@ var AnimusWebpackPlugin = class {
|
|
|
22
22
|
/** This turn's rejected analysis. A rejection must fail the compilation,
|
|
23
23
|
* never `watchRun`: webpack stops watching after a failed `watchRun`. */
|
|
24
24
|
watchFailure = null;
|
|
25
|
-
|
|
25
|
+
/** `development` is `next dev`: an error-level diagnostic reports and the
|
|
26
|
+
* compilation keeps publishing, whatever the emission mode. */
|
|
27
|
+
constructor(options, { development = false } = {}) {
|
|
26
28
|
this.options = options;
|
|
27
29
|
assertNoRetiredEngineSelection(options.engine);
|
|
28
30
|
setSharedEngine(options.engine ?? "v2");
|
|
29
31
|
this.session = new ExtractionSession(options);
|
|
32
|
+
this.session.development = development;
|
|
30
33
|
this.session.systemPropsModuleId = TURBOPACK_SYSTEM_PROPS_ID;
|
|
31
34
|
this.animusLoaderPaths = /* @__PURE__ */ new Set([resolveAnimusLoaderPath()]);
|
|
32
35
|
if (options.loaderPath) this.animusLoaderPaths.add(options.loaderPath);
|
|
@@ -50,6 +53,12 @@ var AnimusWebpackPlugin = class {
|
|
|
50
53
|
else if (ignored instanceof RegExp) watchOptions.ignored = (path) => path === epochPath || ignored.test(path);
|
|
51
54
|
else if (isWatchIgnoreMatcher(ignored)) watchOptions.ignored = (path) => path === epochPath || Boolean(ignored(path));
|
|
52
55
|
}
|
|
56
|
+
/** Webpack's export conditions select the system's kit files as they
|
|
57
|
+
* select the bundle's; `...`, webpack's own defaults, names none. */
|
|
58
|
+
extractConditions(compiler) {
|
|
59
|
+
const names = compiler.options?.resolve?.conditionNames ?? [];
|
|
60
|
+
this.session.conditions = names.filter((name) => name !== "...");
|
|
61
|
+
}
|
|
53
62
|
extractAliases(compiler) {
|
|
54
63
|
if (this.aliasesExtracted) return;
|
|
55
64
|
this.aliasesExtracted = true;
|
|
@@ -120,6 +129,7 @@ var AnimusWebpackPlugin = class {
|
|
|
120
129
|
compiler.hooks.run.tapPromise(PLUGIN_NAME, async (_compiler) => {
|
|
121
130
|
this.adoptCompilerContext(_compiler);
|
|
122
131
|
this.extractAliases(_compiler);
|
|
132
|
+
this.extractConditions(_compiler);
|
|
123
133
|
const existing = getAnalysisStartedPromise();
|
|
124
134
|
if (existing) {
|
|
125
135
|
await existing;
|
|
@@ -132,6 +142,7 @@ var AnimusWebpackPlugin = class {
|
|
|
132
142
|
compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, async (_compiler) => {
|
|
133
143
|
this.adoptCompilerContext(_compiler);
|
|
134
144
|
this.extractAliases(_compiler);
|
|
145
|
+
this.extractConditions(_compiler);
|
|
135
146
|
try {
|
|
136
147
|
await this.analyzeWatchTurn(_compiler);
|
|
137
148
|
this.watchFailure = null;
|
|
@@ -240,7 +251,8 @@ function withAnimus(options) {
|
|
|
240
251
|
warnedUnstableTurbopack = true;
|
|
241
252
|
console.warn("[animus-extract] `unstable_turbopack` is deprecated — rename it to `turbopack` (same shape)");
|
|
242
253
|
}
|
|
243
|
-
return (
|
|
254
|
+
return (authoredConfig) => {
|
|
255
|
+
const nextConfig = withSourceKits(authoredConfig, process.cwd());
|
|
244
256
|
if (resolveTurbopackMode(options)) return turbopackConfig(nextConfig, options);
|
|
245
257
|
const existingWebpack = nextConfig.webpack;
|
|
246
258
|
return {
|
|
@@ -252,7 +264,7 @@ function withAnimus(options) {
|
|
|
252
264
|
const plugin = new AnimusWebpackPlugin({
|
|
253
265
|
...options,
|
|
254
266
|
mode
|
|
255
|
-
});
|
|
267
|
+
}, { development: context.dev === true });
|
|
256
268
|
plugin.setRootDir(rootDir);
|
|
257
269
|
const sessionDir = plugin.sessionDir;
|
|
258
270
|
if (!existsSync(sessionDir)) mkdirSync(sessionDir, { recursive: true });
|
|
@@ -300,7 +312,13 @@ function withAnimus(options) {
|
|
|
300
312
|
nmf.hooks.afterResolve.tap("AnimusVirtualResolve", (resolveData) => {
|
|
301
313
|
const sideEffects = redirectSideEffects.get(resolveData);
|
|
302
314
|
const settings = resolveData.createData?.settings;
|
|
303
|
-
if (
|
|
315
|
+
if (!settings) return;
|
|
316
|
+
if (sideEffects !== void 0) {
|
|
317
|
+
settings.sideEffects = sideEffects;
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const resource = resolveData.createData?.resource;
|
|
321
|
+
if (resource !== void 0 && keepsKitSourceEffects(resource, plugin.getExternalPackageDirs())) settings.sideEffects = true;
|
|
304
322
|
});
|
|
305
323
|
});
|
|
306
324
|
} });
|
|
@@ -318,6 +336,7 @@ function withAnimus(options) {
|
|
|
318
336
|
loader: actualLoaderPath,
|
|
319
337
|
options: {
|
|
320
338
|
strict: options.strict,
|
|
339
|
+
development: context.dev === true,
|
|
321
340
|
cssImportTarget: options.cssImportTarget
|
|
322
341
|
}
|
|
323
342
|
}]
|
|
@@ -334,6 +353,20 @@ function bindTurbopackWatchDeathReport(outcome, rootDir) {
|
|
|
334
353
|
console.error(`[animus-extract] dev watcher for ${rootDir} died — source edits are no longer extracted; restart the dev server`);
|
|
335
354
|
};
|
|
336
355
|
}
|
|
356
|
+
/** The config with the source kits the app depends on added to
|
|
357
|
+
* `transpilePackages`. The kit redirect points both bundles at a kit's
|
|
358
|
+
* source, but Next's server keeps an installed package external, and so
|
|
359
|
+
* loads its runtime entry, unless the package is transpiled; transpiling
|
|
360
|
+
* also compiles its TypeScript source. */
|
|
361
|
+
function withSourceKits(nextConfig, rootDir) {
|
|
362
|
+
const declared = nextConfig.transpilePackages ?? [];
|
|
363
|
+
const kits = sourceKitDependencies(rootDir).map((kit) => kit.name).filter((name) => !declared.includes(name));
|
|
364
|
+
if (kits.length === 0) return nextConfig;
|
|
365
|
+
return {
|
|
366
|
+
...nextConfig,
|
|
367
|
+
transpilePackages: [...declared, ...kits]
|
|
368
|
+
};
|
|
369
|
+
}
|
|
337
370
|
function turbopackConfig(nextConfig, options) {
|
|
338
371
|
const load = (phase) => loadTurbopackFragment(options, phase).then((fragment) => mergeTurbopackFragment(nextConfig, fragment));
|
|
339
372
|
function then(onResolved, onRejected) {
|
|
@@ -377,6 +410,7 @@ async function analyzeForTurbopack(options, phase, rootDir) {
|
|
|
377
410
|
liveTurbopackWatcher?.close();
|
|
378
411
|
liveTurbopackWatcher = null;
|
|
379
412
|
liveTurbopackSession = session;
|
|
413
|
+
session.development = development;
|
|
380
414
|
session.rootDir = rootDir;
|
|
381
415
|
const aliasPairs = readTsconfigAliasPairs(rootDir);
|
|
382
416
|
const builtAliases = buildPathAliasesJson(aliasPairs, rootDir);
|
|
@@ -387,6 +421,7 @@ async function analyzeForTurbopack(options, phase, rootDir) {
|
|
|
387
421
|
bindTurbopackWatchDeathReport(outcome, rootDir);
|
|
388
422
|
if (outcome.kind === "started") liveTurbopackWatcher = outcome.handle;
|
|
389
423
|
}
|
|
424
|
+
for (const line of turbopackSideEffectsLimits(rootDir, session.externalSourceEntries, session.externalSourceSideEffects)) console.warn(line);
|
|
390
425
|
return buildTurbopackConfig({
|
|
391
426
|
rootDir,
|
|
392
427
|
loaderPath: resolveTurbopackLoaderPath(__dirname),
|
|
@@ -79,8 +79,9 @@ function transformWithManifest(args) {
|
|
|
79
79
|
return code;
|
|
80
80
|
} catch (e) {
|
|
81
81
|
const msg = e instanceof Error ? e.message : String(e);
|
|
82
|
-
if (opts.strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
|
|
83
|
-
console.
|
|
82
|
+
if (opts.strict && !opts.development) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
|
|
83
|
+
if (opts.strict) console.error(`[animus-extract] Transform failed for ${filename}: ${msg}`);
|
|
84
|
+
else console.warn(`[animus-extract] Transform failed for ${filename}:`, msg);
|
|
84
85
|
return source;
|
|
85
86
|
}
|
|
86
87
|
}
|
|
@@ -79,8 +79,9 @@ function transformWithManifest(args) {
|
|
|
79
79
|
return code;
|
|
80
80
|
} catch (e) {
|
|
81
81
|
const msg = e instanceof Error ? e.message : String(e);
|
|
82
|
-
if (opts.strict) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
|
|
83
|
-
console.
|
|
82
|
+
if (opts.strict && !opts.development) throw new Error(`[animus-extract] Transform failed for ${filename}: ${msg}`, { cause: e });
|
|
83
|
+
if (opts.strict) console.error(`[animus-extract] Transform failed for ${filename}: ${msg}`);
|
|
84
|
+
else console.warn(`[animus-extract] Transform failed for ${filename}:`, msg);
|
|
84
85
|
return source;
|
|
85
86
|
}
|
|
86
87
|
}
|
package/dist/loader-core.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export interface LoaderPolicyOptions {
|
|
2
2
|
strict?: boolean;
|
|
3
|
+
/** `next dev`: a strict transform failure reports and delivers the
|
|
4
|
+
* source, as a non-strict one does, instead of failing the module. */
|
|
5
|
+
development?: boolean;
|
|
3
6
|
cssImportTarget?: string;
|
|
4
7
|
}
|
|
5
8
|
export interface LoaderContextBase<O extends LoaderPolicyOptions = LoaderPolicyOptions> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader-core.d.ts","sourceRoot":"","sources":["../src/loader-core.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,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H,wBAAgB,aAAa,CAC3B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,SAAS,MAAM,EAAE,CAKnB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GAC7D,MAAM,CAMR;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IAErB,SAAS,EAAE,MAAM,GAAG,CAAC;IACrB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,GAAG,MAAM,CA6CT"}
|
package/dist/loader.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_loader_core = require("./loader-core-
|
|
1
|
+
const require_loader_core = require("./loader-core-CAr8opFH.cjs");
|
|
2
2
|
let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
|
|
3
3
|
let _animus_ui_extract_session = require("@animus-ui/extract/session");
|
|
4
4
|
let fs = require("fs");
|
package/dist/loader.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as extensionLineage, r as transformWithManifest, t as extendedFiles } from "./loader-core-
|
|
1
|
+
import { n as extensionLineage, r as transformWithManifest, t as extendedFiles } from "./loader-core-pACpByOT.mjs";
|
|
2
2
|
import { contentHash } from "@animus-ui/extract/pipeline";
|
|
3
3
|
import { engineApi, getAnalyzedHashes, getManifestJson, getSessionArtifactDir, replacementEpochPath } from "@animus-ui/extract/session";
|
|
4
4
|
import { existsSync } from "fs";
|
package/dist/plugin.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ type Compiler = {
|
|
|
72
72
|
name?: string;
|
|
73
73
|
resolve?: {
|
|
74
74
|
alias?: WebpackAliasMap;
|
|
75
|
+
conditionNames?: string[];
|
|
75
76
|
};
|
|
76
77
|
watchOptions?: {
|
|
77
78
|
ignored?: WatchIgnored;
|
|
@@ -102,9 +103,16 @@ export declare class AnimusWebpackPlugin {
|
|
|
102
103
|
/** This turn's rejected analysis. A rejection must fail the compilation,
|
|
103
104
|
* never `watchRun`: webpack stops watching after a failed `watchRun`. */
|
|
104
105
|
private watchFailure;
|
|
105
|
-
|
|
106
|
+
/** `development` is `next dev`: an error-level diagnostic reports and the
|
|
107
|
+
* compilation keeps publishing, whatever the emission mode. */
|
|
108
|
+
constructor(options: AnimusNextOptions, { development }?: {
|
|
109
|
+
development?: boolean;
|
|
110
|
+
});
|
|
106
111
|
private moduleUsesAnimusLoader;
|
|
107
112
|
private appendEpochWatchIgnore;
|
|
113
|
+
/** Webpack's export conditions select the system's kit files as they
|
|
114
|
+
* select the bundle's; `...`, webpack's own defaults, names none. */
|
|
115
|
+
private extractConditions;
|
|
108
116
|
private extractAliases;
|
|
109
117
|
apply(compiler: Compiler): void;
|
|
110
118
|
/** Rejects with the analysis error; the published generation stays the
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,KAAK,aAAa,GAAG;IACnB,MAAM,IAAI,MAAM,GAAG,MAAM,CAAC;IAC1B,IAAI,IAAI,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,gBAAgB,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAEpD,KAAK,YAAY,GACb,gBAAgB,GAChB,gBAAgB,EAAE,GAClB,kBAAkB,GAClB,IAAI,GACJ,SAAS,CAAC;A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uB;IAC7C,OAAO,CAAC,4BAA4B,CAAS;IAC7C;8EAC0E;IAC1E,OAAO,CAAC,YAAY,CAAsB;IAE1C;oEACgE;IAChE,YACE,OAAO,EAAE,iBAAiB,EAC1B,EAAE,WAAmB,EAAE,GAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAO,EAexD;IAED,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,sBAAsB;IA2B9B;0EACsE;IACtE,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,cAAc;IAyBtB,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAqG9B;IAED;+BAC2B;YACb,gBAAgB;IAwC9B,WAAW,IAAI,IAAI,CAElB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhC;IAED,OAAO,CAAC,oBAAoB,CAAS;IAErC;;;6EAGyE;IACzE,OAAO,CAAC,oBAAoB;IAqB5B,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,UAAU,IAAI,iBAAiB,CAE9B;IAED,sBAAsB,IAAI,MAAM,EAAE,CAIjC;IAED,wBAAwB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAI9C;IAED;gCAC4B;IAC5B,4BAA4B,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAInD;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ENGINE_TRANSFORM_EXTENSIONS } from "@animus-ui/extract/pipeline";
|
|
1
|
+
import { ENGINE_TRANSFORM_EXTENSIONS, fileSideEffects, findPackageRoot, kitSourceModuleSideEffects } from "@animus-ui/extract/pipeline";
|
|
2
2
|
import { ANIMUS_CSS_MODULE_ID, STYLES_ARTIFACT, SYSTEM_PROPS_ARTIFACT, TURBOPACK_SYSTEM_PROPS_ID as TURBOPACK_SYSTEM_PROPS_ID$1 } from "@animus-ui/extract/session";
|
|
3
3
|
import { existsSync } from "fs";
|
|
4
4
|
import { dirname, join, relative, resolve } from "path";
|
|
@@ -60,8 +60,26 @@ function buildTurbopackConfig(args) {
|
|
|
60
60
|
resolveAlias
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Turbopack aliases a kit entry to its source with no per-module setting, so
|
|
65
|
+
* it reads the package's `sideEffects` against the source file's own path.
|
|
66
|
+
* One line for each redirect whose source that reading classifies otherwise
|
|
67
|
+
* than the entry it replaces, and one for each kit whose list names shipped
|
|
68
|
+
* code, which Turbopack reads against every source module the redirects
|
|
69
|
+
* reach: Turbopack cannot represent the declaration.
|
|
70
|
+
*/
|
|
71
|
+
function turbopackSideEffectsLimits(rootDir, externalSourceEntries, externalSourceSideEffects) {
|
|
72
|
+
const modules = [...new Set([...externalSourceEntries.values()].filter((srcEntry) => kitSourceModuleSideEffects(srcEntry) === true).map(findPackageRoot))].map((pkgRoot) => `[animus-extract] Turbopack cannot keep the source modules of ${relative(rootDir, pkgRoot).replace(/\\/g, "/")} side-effectful: the package's "sideEffects" list names shipped code, and Turbopack reads that list against each source module, so it can drop a listed effect of a module the source imports. List the source modules in "sideEffects" too, or build with webpack.`);
|
|
73
|
+
return [...[...externalSourceEntries].flatMap(([specifier, srcEntry]) => {
|
|
74
|
+
const declared = externalSourceSideEffects.get(specifier);
|
|
75
|
+
if (declared === void 0) return [];
|
|
76
|
+
const read = fileSideEffects(srcEntry) ?? true;
|
|
77
|
+
if (read === declared) return [];
|
|
78
|
+
return [`[animus-extract] Turbopack cannot carry the "sideEffects" of ${specifier} to its source ${relative(rootDir, srcEntry).replace(/\\/g, "/")}: the package's "sideEffects" classify the shipped entry as ${declared ? "side-effectful" : "free of side effects"} but the source as ${read ? "side-effectful" : "free of side effects"}, so ${declared ? "Turbopack can drop its side effects" : "Turbopack keeps it when it is unused"}. Make the package's "sideEffects" classify the source as it classifies the shipped entry, or build with webpack.`];
|
|
79
|
+
}), ...modules];
|
|
80
|
+
}
|
|
63
81
|
function resolveTurbopackLoaderPath(pluginDir) {
|
|
64
82
|
return resolveLoaderPath(pluginDir, ["turbopack-loader.cjs", "turbopack-loader.mjs"], "turbopack-loader.ts");
|
|
65
83
|
}
|
|
66
84
|
//#endregion
|
|
67
|
-
export { resolveTurbopackMode as a, resolveTurbopackLoaderPath as i, buildTurbopackConfig as n,
|
|
85
|
+
export { resolveTurbopackMode as a, resolveTurbopackLoaderPath as i, buildTurbopackConfig as n, turbopackSideEffectsLimits as o, isTurbopackDevelopment as r, resolveAnimusLoaderPath as s, ANIMUS_TURBOPACK_RULE_GLOB as t };
|
|
@@ -59,6 +59,24 @@ function buildTurbopackConfig(args) {
|
|
|
59
59
|
resolveAlias
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Turbopack aliases a kit entry to its source with no per-module setting, so
|
|
64
|
+
* it reads the package's `sideEffects` against the source file's own path.
|
|
65
|
+
* One line for each redirect whose source that reading classifies otherwise
|
|
66
|
+
* than the entry it replaces, and one for each kit whose list names shipped
|
|
67
|
+
* code, which Turbopack reads against every source module the redirects
|
|
68
|
+
* reach: Turbopack cannot represent the declaration.
|
|
69
|
+
*/
|
|
70
|
+
function turbopackSideEffectsLimits(rootDir, externalSourceEntries, externalSourceSideEffects) {
|
|
71
|
+
const modules = [...new Set([...externalSourceEntries.values()].filter((srcEntry) => (0, _animus_ui_extract_pipeline.kitSourceModuleSideEffects)(srcEntry) === true).map(_animus_ui_extract_pipeline.findPackageRoot))].map((pkgRoot) => `[animus-extract] Turbopack cannot keep the source modules of ${(0, path.relative)(rootDir, pkgRoot).replace(/\\/g, "/")} side-effectful: the package's "sideEffects" list names shipped code, and Turbopack reads that list against each source module, so it can drop a listed effect of a module the source imports. List the source modules in "sideEffects" too, or build with webpack.`);
|
|
72
|
+
return [...[...externalSourceEntries].flatMap(([specifier, srcEntry]) => {
|
|
73
|
+
const declared = externalSourceSideEffects.get(specifier);
|
|
74
|
+
if (declared === void 0) return [];
|
|
75
|
+
const read = (0, _animus_ui_extract_pipeline.fileSideEffects)(srcEntry) ?? true;
|
|
76
|
+
if (read === declared) return [];
|
|
77
|
+
return [`[animus-extract] Turbopack cannot carry the "sideEffects" of ${specifier} to its source ${(0, path.relative)(rootDir, srcEntry).replace(/\\/g, "/")}: the package's "sideEffects" classify the shipped entry as ${declared ? "side-effectful" : "free of side effects"} but the source as ${read ? "side-effectful" : "free of side effects"}, so ${declared ? "Turbopack can drop its side effects" : "Turbopack keeps it when it is unused"}. Make the package's "sideEffects" classify the source as it classifies the shipped entry, or build with webpack.`];
|
|
78
|
+
}), ...modules];
|
|
79
|
+
}
|
|
62
80
|
function resolveTurbopackLoaderPath(pluginDir) {
|
|
63
81
|
return resolveLoaderPath(pluginDir, ["turbopack-loader.cjs", "turbopack-loader.mjs"], "turbopack-loader.ts");
|
|
64
82
|
}
|
|
@@ -99,3 +117,9 @@ Object.defineProperty(exports, "resolveTurbopackMode", {
|
|
|
99
117
|
return resolveTurbopackMode;
|
|
100
118
|
}
|
|
101
119
|
});
|
|
120
|
+
Object.defineProperty(exports, "turbopackSideEffectsLimits", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function() {
|
|
123
|
+
return turbopackSideEffectsLimits;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
@@ -33,5 +33,14 @@ export declare function buildTurbopackConfig(args: {
|
|
|
33
33
|
sessionDir: string;
|
|
34
34
|
development: boolean;
|
|
35
35
|
}): TurbopackConfigFragment;
|
|
36
|
+
/**
|
|
37
|
+
* Turbopack aliases a kit entry to its source with no per-module setting, so
|
|
38
|
+
* it reads the package's `sideEffects` against the source file's own path.
|
|
39
|
+
* One line for each redirect whose source that reading classifies otherwise
|
|
40
|
+
* than the entry it replaces, and one for each kit whose list names shipped
|
|
41
|
+
* code, which Turbopack reads against every source module the redirects
|
|
42
|
+
* reach: Turbopack cannot represent the declaration.
|
|
43
|
+
*/
|
|
44
|
+
export declare function turbopackSideEffectsLimits(rootDir: string, externalSourceEntries: ReadonlyMap<string, string>, externalSourceSideEffects: ReadonlyMap<string, boolean>): string[];
|
|
36
45
|
export declare function resolveTurbopackLoaderPath(pluginDir: string): string;
|
|
37
46
|
//# sourceMappingURL=turbopack-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turbopack-config.d.ts","sourceRoot":"","sources":["../src/turbopack-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"turbopack-config.d.ts","sourceRoot":"","sources":["../src/turbopack-config.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AAKpC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;wEACwE;AAExE,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,IAAI,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,sBAAsB,CAAA;KAAE,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;;0DAG0D;AAC1D,eAAO,MAAM,0BAA0B,QAAiD,CAAC;AAEzF,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,iBAAiB,EAC1B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAMT;AAED;0CAC0C;AAC1C,wBAAgB,sBAAsB,CACpC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GACpD,OAAO,CAET;AAMD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,qBAAqB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB,GAAG,uBAAuB,CA4C1B;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,qBAAqB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAClD,yBAAyB,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACtD,MAAM,EAAE,CA0BV;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMpE"}
|
|
@@ -24,8 +24,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
enumerable: true
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
//#endregion
|
|
27
|
-
const require_turbopack_config = require("./turbopack-config-
|
|
28
|
-
const require_loader_core = require("./loader-core-
|
|
27
|
+
const require_turbopack_config = require("./turbopack-config-D-6BRBYi.cjs");
|
|
28
|
+
const require_loader_core = require("./loader-core-CAr8opFH.cjs");
|
|
29
29
|
let _animus_ui_extract_pipeline = require("@animus-ui/extract/pipeline");
|
|
30
30
|
let _animus_ui_extract_session = require("@animus-ui/extract/session");
|
|
31
31
|
let fs = require("fs");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as isTurbopackDevelopment } from "./turbopack-config-
|
|
2
|
-
import { n as extensionLineage, r as transformWithManifest, t as extendedFiles } from "./loader-core-
|
|
1
|
+
import { r as isTurbopackDevelopment } from "./turbopack-config-BdfqxwT0.mjs";
|
|
2
|
+
import { n as extensionLineage, r as transformWithManifest, t as extendedFiles } from "./loader-core-pACpByOT.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { buildAnalyzeProjectArgs, contentHash, createV2EngineApi, parseFilesJson } from "@animus-ui/extract/pipeline";
|
|
5
5
|
import { analysisCommitPath, analysisInputsPath, analysisStatusPath, manifestPath, readJsonEnvelope, replacementEpochPath, sessionArtifactDir } from "@animus-ui/extract/session";
|
package/dist/types.d.ts
CHANGED
|
@@ -9,21 +9,27 @@ export interface AnimusNextOptions {
|
|
|
9
9
|
* `['.ts','.tsx','.js','.jsx','.mdx']`. `.mdx` needs `@mdx-js/mdx`. */
|
|
10
10
|
extensions?: string[];
|
|
11
11
|
/** When true, error-severity diagnostics — lost configured inputs and
|
|
12
|
-
* classified unsupported Animus declarations —
|
|
13
|
-
*
|
|
12
|
+
* classified unsupported Animus declarations — and failed checks, such as
|
|
13
|
+
* an unresolved include or `asset()` specifier or a failed module
|
|
14
|
+
* transform, fail a build instead of warning. `next dev` reports them and
|
|
15
|
+
* keeps running. Omitted or `false` warns. */
|
|
14
16
|
strict?: boolean;
|
|
15
17
|
/**
|
|
16
|
-
* Each `animus.*` code's level, by exact code
|
|
17
|
-
* (`'animus.style.*'`)
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Each `animus.*` code's level, by exact code, by a prefix ending in `.*`
|
|
19
|
+
* (`'animus.style.*'`), or by kind (`'kind:bail'`, `'kind:skip'`,
|
|
20
|
+
* `'kind:warn'`, `'kind:error'`): `'off'`, `'info'`, `'warn'` or `'error'`,
|
|
21
|
+
* which fails a build and is reported by `next dev`, which keeps running.
|
|
22
|
+
* An exact code beats the longest matching prefix, which beats a kind, and
|
|
23
|
+
* an entry beats `strict` and the code's own severity.
|
|
20
24
|
*/
|
|
21
25
|
diagnostics?: DiagnosticLevels;
|
|
22
26
|
/** Project-root-relative path of the one file that receives the stylesheet
|
|
23
27
|
* import; replaces the `app/layout.*` / `pages/_app.*` detection. */
|
|
24
28
|
cssImportTarget?: string;
|
|
25
29
|
verbose?: boolean | 'trace';
|
|
26
|
-
/** Namespace prefix for
|
|
30
|
+
/** Namespace prefix for the names Animus generates: theme token
|
|
31
|
+
* variables, classes and slots. Contextual variables keep their declared
|
|
32
|
+
* names unless `prefixContextualVars` is set. */
|
|
27
33
|
prefix?: string;
|
|
28
34
|
/** With `prefix` set, contextual variables take the prefixed name
|
|
29
35
|
* everywhere Animus emits them, while authors keep writing the declared
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAErC,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf;+EAC2E;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;4EACwE;IACxE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AAErC,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf;+EAC2E;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;4EACwE;IACxE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;mDAI+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B;0EACsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B;;sDAEkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;gBAEY;IACZ,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;yEACqE;IACrE,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B;mDAC+C;IAC/C,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;wDACoD;IACpD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;yEACqE;IACrE,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IACpC;gFAC4E;IAC5E,MAAM,CAAC,EAAE,IAAI,CAAC;IACd;qEACiE;IACjE,SAAS,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAA;KAAE,CAAC;IAC7C;;;;sBAIkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;sCACkC;IAClC,kBAAkB,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACtD;qEACiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;+EAC2E;IAC3E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-animus.d.ts","sourceRoot":"","sources":["../src/with-animus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-animus.d.ts","sourceRoot":"","sources":["../src/with-animus.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,UAAU,IAAI,eAAe,EAC7B,gBAAgB,EACjB,MAAM,gCAAgC,CAAC;AAKxC,KAAK,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAE5D,UAAU,gBAAgB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AAI,wBAAwB,EAAE,CAAC;AAE/D,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,eAAe,IACxD,MAAM,SAAS,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,kBAAkB,CAAC;AAE1E,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,eAAe,IAAI,IAAI,CAClE,MAAM,EACN,SAAS,CACV,GAAG;IACF,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,MAAM,SAAS,eAAe,IAAI,IAAI,CAC1E,MAAM,EACN,WAAW,CACZ,GAAG;IACF,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF;;;;4DAI4D;AAC5D,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,eAAe,IAAI,CAAC,CACjE,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,GAC9C,WAAW,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;AAUjD,wBAAgB,UAAU,CACxB,OAAO,EAAE,iBAAiB,GACzB,CAAC,MAAM,SAAS,eAAe,EAChC,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,KAChC,iBAAiB,CAAC,MAAM,CAAC,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAuP3D;AAQD,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,MAAM,GACd,IAAI,CASN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/next-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Animus static CSS extraction for Next.js (webpack)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animus",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"compile": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@animus-ui/extract": "0.1.
|
|
43
|
+
"@animus-ui/extract": "0.1.25"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@animus-ui/assertions": "0.1.
|
|
46
|
+
"@animus-ui/assertions": "0.1.25"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@mdx-js/mdx": "^3.0.0",
|