@stillwind/integration 0.7.0 → 0.8.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/astro/index.js +1 -1
- package/dist/fresh/index.js +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/{plugin-DOKl8qk3.js → plugin-ByYcpBcE.js} +49 -9
- package/dist/plugin-ByYcpBcE.js.map +1 -0
- package/dist/vite/index.js +1 -1
- package/package.json +6 -6
- package/dist/plugin-DOKl8qk3.js.map +0 -1
package/dist/astro/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-ByYcpBcE.js";
|
|
2
2
|
import { registerDevelopmentCss } from "./development.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
package/dist/fresh/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { r as createViteProject, t as createVitePlugins } from "../plugin-ByYcpBcE.js";
|
|
2
2
|
// src/fresh/manifest.ts
|
|
3
3
|
/** Filters repeated static files for Fresh's move operation without changing the emitted manifest. */
|
|
4
4
|
function registrationManifest(source) {
|
package/dist/nuxt/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { r as createViteProject, t as createVitePlugins } from "../plugin-ByYcpBcE.js";
|
|
2
2
|
import { addPluginTemplate, defineNuxtModule } from "nuxt/kit";
|
|
3
3
|
// src/nuxt/index.ts
|
|
4
4
|
/**
|
|
@@ -710,6 +710,52 @@ function minifyTargets(target) {
|
|
|
710
710
|
function finalizeModuleWithMap$1(code, includeStylesheet = true) {
|
|
711
711
|
return finalizeModuleWithMap(code, includeStylesheet ? virtualCssId : void 0);
|
|
712
712
|
}
|
|
713
|
+
// src/vite/server-source-resolve.ts
|
|
714
|
+
/** Text of the error that React Router throws when a client module resolves a server-only source. */
|
|
715
|
+
const serverOnlyImportMessage = "Server-only module referenced by client";
|
|
716
|
+
/** Number of resolutions before a React Router server-only import error is passed to the caller. */
|
|
717
|
+
const serverSourceResolveAttempts = 5;
|
|
718
|
+
/**
|
|
719
|
+
* Resolves an import whose target may be a server-only source, through the other Vite plugins.
|
|
720
|
+
*
|
|
721
|
+
* Rolldown can deliver the `custom` option of one `this.resolve()` call to a different call that
|
|
722
|
+
* runs at the same time (https://github.com/rolldown/rolldown/issues/11180). It stores the options
|
|
723
|
+
* of each pending call under the current size of a map. After an earlier call finishes, a new call
|
|
724
|
+
* can receive the key of a pending call and replace its options. React Router then does not see
|
|
725
|
+
* the flag from {@link ServerSourceResolveOptions} and throws for a valid Stillwind read, for example
|
|
726
|
+
* `../server.server.js?stillwind.css` in a route module. This retry is a workaround and is not
|
|
727
|
+
* needed after Rolldown gives each pending call its own key. Other plugin errors and other
|
|
728
|
+
* failures are passed to the caller without a retry.
|
|
729
|
+
*
|
|
730
|
+
* @param resolve - Resolver of the current Vite hook context. Each call must be independent, so
|
|
731
|
+
* the same arguments can be resolved again. Each call receives a new options object.
|
|
732
|
+
* @param specifier - Import text without the Stillwind resource query.
|
|
733
|
+
* @param importer - Resolver identity of the importing module.
|
|
734
|
+
* @returns The result of the first resolution that does not throw React Router's server-only
|
|
735
|
+
* import error.
|
|
736
|
+
* @throws The error of the last attempt if each attempt throws React Router's server-only import
|
|
737
|
+
* error, or the first error of another kind.
|
|
738
|
+
*/
|
|
739
|
+
async function resolveServerSource(resolve, specifier, importer) {
|
|
740
|
+
for (let attempt = 1;; attempt++) try {
|
|
741
|
+
return await resolve(specifier, importer, {
|
|
742
|
+
skipSelf: true,
|
|
743
|
+
custom: { "react-router:dot-server": true }
|
|
744
|
+
});
|
|
745
|
+
} catch (error) {
|
|
746
|
+
if (attempt >= serverSourceResolveAttempts || !isServerOnlyImportError(error)) throw error;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Checks whether a resolver error, or one of its causes, is React Router's server-only import error.
|
|
751
|
+
*
|
|
752
|
+
* @param error - Value thrown by a resolver. Rolldown can wrap the plugin error in another error.
|
|
753
|
+
* @returns True when the message of the error or of a cause contains React Router's message.
|
|
754
|
+
*/
|
|
755
|
+
function isServerOnlyImportError(error) {
|
|
756
|
+
for (let current = error; current instanceof Error; current = current.cause) if (current.message.includes(serverOnlyImportMessage)) return true;
|
|
757
|
+
return false;
|
|
758
|
+
}
|
|
713
759
|
// src/vite/compile.ts
|
|
714
760
|
/**
|
|
715
761
|
* Compiles a producer and prepares its generated imports, source map, and cache metadata.
|
|
@@ -743,10 +789,7 @@ async function compileProducer(compiler, settings, config, registry, code, id, c
|
|
|
743
789
|
return clean.startsWith("\0") || clean.startsWith("virtual:") ? `stillwind-virtual:${encodeURIComponent(clean)}` : pathToFileURL(clean).href;
|
|
744
790
|
};
|
|
745
791
|
const output = await compiler.compile(code, id, {
|
|
746
|
-
resolve: (specifier, importer) => context.resolve(specifier, importer,
|
|
747
|
-
skipSelf: true,
|
|
748
|
-
custom: { "react-router:dot-server": true }
|
|
749
|
-
}),
|
|
792
|
+
resolve: (specifier, importer) => resolveServerSource((specifier, importer, options) => context.resolve(specifier, importer, options), specifier, importer),
|
|
750
793
|
read: (id) => readFile(cleanModuleId(id), "utf8"),
|
|
751
794
|
describe: (resolvedId) => {
|
|
752
795
|
const virtual = resolvedId.startsWith("\0") || resolvedId.startsWith("virtual:");
|
|
@@ -2155,10 +2198,7 @@ function transformHooks(project, virtualModules, options = {}) {
|
|
|
2155
2198
|
}
|
|
2156
2199
|
const projections = /* @__PURE__ */ new Map();
|
|
2157
2200
|
for (const specifier of await projectionImports(code, id)) {
|
|
2158
|
-
const source = await this.resolve(specifier.slice(0, -14), id
|
|
2159
|
-
skipSelf: true,
|
|
2160
|
-
custom: { "react-router:dot-server": true }
|
|
2161
|
-
});
|
|
2201
|
+
const source = await resolveServerSource(this.resolve.bind(this), specifier.slice(0, -14), id);
|
|
2162
2202
|
if (!source || source.external) this.error(`Cannot resolve Stillwind projection ${specifier}`);
|
|
2163
2203
|
await readableFile(source.id, settings.devServerRef);
|
|
2164
2204
|
projections.set(specifier, source.id);
|
|
@@ -2642,4 +2682,4 @@ function compilerPlugin(project, transform, closed) {
|
|
|
2642
2682
|
}
|
|
2643
2683
|
export { renderChunkStyles as i, stillwind as n, createViteProject as r, createVitePlugins as t };
|
|
2644
2684
|
|
|
2645
|
-
//# sourceMappingURL=plugin-
|
|
2685
|
+
//# sourceMappingURL=plugin-ByYcpBcE.js.map
|