@absolutejs/absolute 0.19.0-beta.732 → 0.19.0-beta.734
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/build.js +10 -7
- package/dist/build.js.map +6 -5
- package/dist/index.js +10 -7
- package/dist/index.js.map +6 -5
- package/dist/src/build/vendorEntrySource.d.ts +26 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Generate a vendor entry source that re-exports both named AND default
|
|
2
|
+
* exports robustly, regardless of whether the source has a default export.
|
|
3
|
+
*
|
|
4
|
+
* Why this is non-trivial:
|
|
5
|
+
* - Per ECMA spec, `export *` re-exports only NAMED exports — never the
|
|
6
|
+
* default. So a vendor wrapping `firebase/compat/app` (whose entire
|
|
7
|
+
* surface is `export { default } from '@firebase/app-compat'`) ends up
|
|
8
|
+
* completely empty, breaking `import firebase from "/vendor/X.js"`.
|
|
9
|
+
* - Naively adding `export { default } from 'X'` makes Bun.build fail with
|
|
10
|
+
* "No matching export for 'default'" when X has no default export.
|
|
11
|
+
* - Heuristic detection from the resolved file (e.g. checking for
|
|
12
|
+
* `export default` or `module.exports`) is unreliable because
|
|
13
|
+
* `Bun.resolveSync` and `Bun.build` can pick different files for the
|
|
14
|
+
* same specifier (CJS `index.js` vs ESM `index.mjs` via the package's
|
|
15
|
+
* `exports` map).
|
|
16
|
+
*
|
|
17
|
+
* Solution: import the package as a namespace and re-export the namespace's
|
|
18
|
+
* default. Works for every shape:
|
|
19
|
+
* - ESM with default: `__ns.default` is the original default value
|
|
20
|
+
* - ESM without default: `__ns.default` is `undefined` (consumer that
|
|
21
|
+
* imports default would have failed against the original package too)
|
|
22
|
+
* - CJS: Bun's interop synthesizes a default on the namespace
|
|
23
|
+
*
|
|
24
|
+
* The namespace import has no compile-time check on `default` existence,
|
|
25
|
+
* so Bun.build accepts it for all packages. */
|
|
26
|
+
export declare const generateVendorEntrySource: (specifier: string) => string;
|
package/package.json
CHANGED