Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3.0] Basic support for import assertions #4646

Merged
merged 17 commits into from Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions LICENSE.md
Expand Up @@ -52,6 +52,13 @@ Repository: https://github.com/acornjs/acorn.git

---------------------------------------

## acorn-import-assertions
License: MIT
By: Sven Sauleau
Repository: https://github.com/xtuc/acorn-import-assertions

---------------------------------------

## acorn-walk
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Expand Down
7 changes: 7 additions & 0 deletions browser/LICENSE.md
Expand Up @@ -52,6 +52,13 @@ Repository: https://github.com/acornjs/acorn.git
---------------------------------------

## acorn-import-assertions
License: MIT
By: Sven Sauleau
Repository: https://github.com/xtuc/acorn-import-assertions

---------------------------------------

## acorn-walk
License: MIT
By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine
Expand Down
22 changes: 7 additions & 15 deletions browser/src/resolveId.ts
@@ -1,9 +1,5 @@
import type {
CustomPluginOptions,
Plugin,
ResolvedId,
ResolveIdResult
} from '../../src/rollup/types';
import { ModuleLoaderResolveId } from '../../src/ModuleLoader';
import type { CustomPluginOptions, Plugin, ResolveIdResult } from '../../src/rollup/types';
import type { PluginDriver } from '../../src/utils/PluginDriver';
import { resolveIdViaPlugins } from '../../src/utils/resolveIdViaPlugins';
import { throwNoFileSystem } from './error';
Expand All @@ -13,16 +9,11 @@ export async function resolveId(
importer: string | undefined,
_preserveSymlinks: boolean,
pluginDriver: PluginDriver,
moduleLoaderResolveId: (
source: string,
importer: string | undefined,
customOptions: CustomPluginOptions | undefined,
isEntry: boolean | undefined,
skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null
) => Promise<ResolvedId | null>,
moduleLoaderResolveId: ModuleLoaderResolveId,
skip: readonly { importer: string | undefined; plugin: Plugin; source: string }[] | null,
customOptions: CustomPluginOptions | undefined,
isEntry: boolean
isEntry: boolean,
assertions: Record<string, string>
): Promise<ResolveIdResult> {
const pluginResult = await resolveIdViaPlugins(
source,
Expand All @@ -31,7 +22,8 @@ export async function resolveId(
moduleLoaderResolveId,
skip,
customOptions,
isEntry
isEntry,
assertions
);
if (pluginResult == null) {
throwNoFileSystem('path.resolve');
Expand Down
5 changes: 3 additions & 2 deletions cli/help.md
Expand Up @@ -36,6 +36,7 @@ Basic options:
--exports <mode> Specify export mode (auto, default, named, none)
--extend Extend global variable defined by --name
--no-externalLiveBindings Do not generate code to support live bindings
--no-externalImportAssertions Omit import assertions in "es" output
--failAfterWarnings Exit with an error if the build produced warnings
--footer <text> Code to insert at end of bundle (outside wrapper)
--no-freeze Do not freeze namespace objects
Expand Down Expand Up @@ -68,8 +69,8 @@ Basic options:
--no-systemNullSetters Do not replace empty SystemJS setters with `null`
--no-treeshake Disable tree-shaking optimisations
--no-treeshake.annotations Ignore pure call annotations
--no-treeshake.moduleSideEffects Assume modules have no side-effects
--no-treeshake.propertyReadSideEffects Ignore property access side-effects
--no-treeshake.moduleSideEffects Assume modules have no side effects
--no-treeshake.propertyReadSideEffects Ignore property access side effects
--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking
--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw
--waitForBundleInput Wait for bundle input files
Expand Down
5 changes: 3 additions & 2 deletions docs/01-command-line-reference.md
Expand Up @@ -366,6 +366,7 @@ Many options have command line equivalents. In those cases, any arguments passed
--no-esModule Do not add __esModule property
--exports <mode> Specify export mode (auto, default, named, none)
--extend Extend global variable defined by --name
--no-externalImportAssertions Omit import assertions in "es" output
--no-externalLiveBindings Do not generate code to support live bindings
--failAfterWarnings Exit with an error if the build produced warnings
--footer <text> Code to insert at end of bundle (outside wrapper)
Expand Down Expand Up @@ -399,8 +400,8 @@ Many options have command line equivalents. In those cases, any arguments passed
--no-systemNullSetters Do not replace empty SystemJS setters with `null`
--no-treeshake Disable tree-shaking optimisations
--no-treeshake.annotations Ignore pure call annotations
--no-treeshake.moduleSideEffects Assume modules have no side-effects
--no-treeshake.propertyReadSideEffects Ignore property access side-effects
--no-treeshake.moduleSideEffects Assume modules have no side effects
--no-treeshake.propertyReadSideEffects Ignore property access side effects
--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking
--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw
--waitForBundleInput Wait for bundle input files
Expand Down