-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24710 from storybookjs/version-non-patch-from-7.6…
….0-alpha.4 Release: Prerelease 7.6.0-alpha.5
- Loading branch information
Showing
154 changed files
with
1,513 additions
and
3,383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
code/builders/builder-webpack5/src/loaders/export-order-loader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { parse } from 'es-module-lexer'; | ||
import MagicString from 'magic-string'; | ||
import type { LoaderContext } from 'webpack'; | ||
|
||
export default async function loader(this: LoaderContext<any>, source: string) { | ||
const callback = this.async(); | ||
|
||
try { | ||
// Do NOT remove await here. The types are wrong! It has to be awaited, | ||
// otherwise it will return a Promise<Promise<...>> when wasm isn't loaded. | ||
const [, exports = []] = await parse(source); | ||
|
||
const namedExportsOrder = exports.some( | ||
(e) => source.substring(e.s, e.e) === '__namedExportsOrder' | ||
); | ||
|
||
if (namedExportsOrder) { | ||
return callback(null, source); | ||
} | ||
|
||
const magicString = new MagicString(source); | ||
const orderedExports = exports.filter((e) => source.substring(e.s, e.e) !== 'default'); | ||
magicString.append( | ||
`;export const __namedExportsOrder = ${JSON.stringify( | ||
orderedExports.map((e) => source.substring(e.s, e.e)) | ||
)};` | ||
); | ||
|
||
const map = magicString.generateMap({ hires: true }); | ||
return callback(null, magicString.toString(), map); | ||
} catch (err) { | ||
return callback(err as any); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.