fontdue-js 3.0.0-alpha2 → 3.0.0-alpha3
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/relay/environment.js +1 -1
- package/dist/vite.js +24 -8
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { handlePossibleCorsError } from '../corsError.js';
|
|
|
3
3
|
|
|
4
4
|
// `__FONTDUE_JS_VERSION__` is replaced by an inline babel plugin
|
|
5
5
|
// (defineVersionPlugin in .babelrc.cjs) with the literal package.json#version.
|
|
6
|
-
const version = "3.0.0-
|
|
6
|
+
const version = "3.0.0-alpha3";
|
|
7
7
|
const IS_SERVER = typeof window === typeof undefined;
|
|
8
8
|
|
|
9
9
|
// Read env from either process.env (Node/Next.js) or import.meta.env (Vite/Astro).
|
package/dist/vite.js
CHANGED
|
@@ -68,16 +68,32 @@ export default function fontdueJs() {
|
|
|
68
68
|
// and SSR paths.
|
|
69
69
|
define: {
|
|
70
70
|
global: 'globalThis'
|
|
71
|
-
},
|
|
72
|
-
ssr: {
|
|
73
|
-
// Run fontdue-js source through Vite's transform pipeline so
|
|
74
|
-
// cjsInterop sees its imports of CJS-shaped Relay/draft-js/fbjs
|
|
75
|
-
// and rewrites them. Otherwise Node externalizes fontdue-js and
|
|
76
|
-
// its `import { graphql } from 'react-relay'` fails — cjs-module-
|
|
77
|
-
// lexer can't extract names from `module.exports = require('./lib')`.
|
|
78
|
-
noExternal: ['fontdue-js']
|
|
79
71
|
}
|
|
80
72
|
};
|
|
73
|
+
},
|
|
74
|
+
// Apply `noExternal` to every server-side Vite environment so
|
|
75
|
+
// fontdue-js source flows through Vite's transform pipeline and
|
|
76
|
+
// cjsInterop can rewrite its imports of CJS-shaped Relay/draft-js/
|
|
77
|
+
// fbjs. The legacy `ssr.noExternal` only covered the default `ssr`
|
|
78
|
+
// environment, so Astro 6's separate `prerender` build externalized
|
|
79
|
+
// fontdue-js and `import { graphql } from 'react-relay'` ran against
|
|
80
|
+
// unrewritten CJS at prerender time.
|
|
81
|
+
//
|
|
82
|
+
// `config.consumer` would be the principled check, but at
|
|
83
|
+
// `configEnvironment` time Vite hasn't populated it yet (undefined
|
|
84
|
+
// for ssr/prerender/client alike). Match by name instead:
|
|
85
|
+
// - 'ssr': default Vite SSR env (plain Vite SSR, RR7)
|
|
86
|
+
// - 'prerender': Astro 6's static-prerender env
|
|
87
|
+
// The `consumer` fallback is kept as future-proofing if a framework
|
|
88
|
+
// ever names its server env something else but does populate consumer.
|
|
89
|
+
configEnvironment(name, config) {
|
|
90
|
+
if (name === 'ssr' || name === 'prerender' || config.consumer === 'server') {
|
|
91
|
+
return {
|
|
92
|
+
resolve: {
|
|
93
|
+
noExternal: ['fontdue-js']
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
81
97
|
}
|
|
82
98
|
}];
|
|
83
99
|
}
|