@rollup/wasm-node 4.9.6 → 4.11.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/bin/rollup +88 -50
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +107 -50
- package/dist/es/shared/parseAst.js +14 -4
- package/dist/es/shared/watch.js +6 -3
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/native.js +8 -1
- package/dist/parseAst.js +2 -2
- package/dist/rollup.d.ts +6 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +6 -3
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +14 -3
- package/dist/shared/rollup.js +105 -48
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/dist/wasm-node/bindings_wasm.js +57 -14
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +27 -26
package/dist/rollup.d.ts
CHANGED
|
@@ -683,6 +683,8 @@ type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
|
|
|
683
683
|
|
|
684
684
|
type OutputPluginOption = MaybePromise<OutputPlugin | NullValue | false | OutputPluginOption[]>;
|
|
685
685
|
|
|
686
|
+
type HashCharacters = 'base64' | 'base36' | 'hex';
|
|
687
|
+
|
|
686
688
|
export interface OutputOptions {
|
|
687
689
|
amd?: AmdOptions;
|
|
688
690
|
assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string);
|
|
@@ -708,6 +710,7 @@ export interface OutputOptions {
|
|
|
708
710
|
freeze?: boolean;
|
|
709
711
|
generatedCode?: GeneratedCodePreset | GeneratedCodeOptions;
|
|
710
712
|
globals?: GlobalsOption;
|
|
713
|
+
hashCharacters?: HashCharacters;
|
|
711
714
|
hoistTransitiveImports?: boolean;
|
|
712
715
|
indent?: string | boolean;
|
|
713
716
|
inlineDynamicImports?: boolean;
|
|
@@ -722,6 +725,7 @@ export interface OutputOptions {
|
|
|
722
725
|
plugins?: OutputPluginOption;
|
|
723
726
|
preserveModules?: boolean;
|
|
724
727
|
preserveModulesRoot?: string;
|
|
728
|
+
reexportProtoFromExternal?: boolean;
|
|
725
729
|
sanitizeFileName?: boolean | ((fileName: string) => string);
|
|
726
730
|
sourcemap?: boolean | 'inline' | 'hidden';
|
|
727
731
|
sourcemapBaseUrl?: string;
|
|
@@ -758,6 +762,7 @@ export interface NormalizedOutputOptions {
|
|
|
758
762
|
freeze: boolean;
|
|
759
763
|
generatedCode: NormalizedGeneratedCodeOptions;
|
|
760
764
|
globals: GlobalsOption;
|
|
765
|
+
hashCharacters: HashCharacters;
|
|
761
766
|
hoistTransitiveImports: boolean;
|
|
762
767
|
indent: true | string;
|
|
763
768
|
inlineDynamicImports: boolean;
|
|
@@ -772,6 +777,7 @@ export interface NormalizedOutputOptions {
|
|
|
772
777
|
plugins: OutputPlugin[];
|
|
773
778
|
preserveModules: boolean;
|
|
774
779
|
preserveModulesRoot: string | undefined;
|
|
780
|
+
reexportProtoFromExternal: boolean;
|
|
775
781
|
sanitizeFileName: (fileName: string) => string;
|
|
776
782
|
sourcemap: boolean | 'inline' | 'hidden';
|
|
777
783
|
sourcemapBaseUrl: string | undefined;
|
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.11.0
|
|
4
|
+
Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -2382,6 +2382,7 @@ var constants = {};
|
|
|
2382
2382
|
exports.FSEVENT_MOVED = 'moved';
|
|
2383
2383
|
exports.FSEVENT_CLONED = 'cloned';
|
|
2384
2384
|
exports.FSEVENT_UNKNOWN = 'unknown';
|
|
2385
|
+
exports.FSEVENT_FLAG_MUST_SCAN_SUBDIRS = 1;
|
|
2385
2386
|
exports.FSEVENT_TYPE_FILE = 'file';
|
|
2386
2387
|
exports.FSEVENT_TYPE_DIRECTORY = 'directory';
|
|
2387
2388
|
exports.FSEVENT_TYPE_SYMLINK = 'symlink';
|
|
@@ -3107,6 +3108,7 @@ const {
|
|
|
3107
3108
|
FSEVENT_MOVED,
|
|
3108
3109
|
// FSEVENT_CLONED,
|
|
3109
3110
|
FSEVENT_UNKNOWN,
|
|
3111
|
+
FSEVENT_FLAG_MUST_SCAN_SUBDIRS,
|
|
3110
3112
|
FSEVENT_TYPE_FILE,
|
|
3111
3113
|
FSEVENT_TYPE_DIRECTORY,
|
|
3112
3114
|
FSEVENT_TYPE_SYMLINK,
|
|
@@ -3218,6 +3220,7 @@ function setFSEventsListener(path, realPath, listener, rawEmitter) {
|
|
|
3218
3220
|
rawEmitter,
|
|
3219
3221
|
watcher: createFSEventsInstance(watchPath, (fullPath, flags) => {
|
|
3220
3222
|
if (!cont.listeners.size) return;
|
|
3223
|
+
if (flags & FSEVENT_FLAG_MUST_SCAN_SUBDIRS) return;
|
|
3221
3224
|
const info = fsevents.getInfo(fullPath, flags);
|
|
3222
3225
|
cont.listeners.forEach(list => {
|
|
3223
3226
|
list(fullPath, flags, info);
|
|
@@ -4036,7 +4039,7 @@ add(paths_, _origAdd, _internal) {
|
|
|
4036
4039
|
|
|
4037
4040
|
if (this.options.useFsEvents && this._fsEventsHandler) {
|
|
4038
4041
|
if (!this._readyCount) this._readyCount = paths.length;
|
|
4039
|
-
if (this.options.persistent) this._readyCount
|
|
4042
|
+
if (this.options.persistent) this._readyCount += paths.length;
|
|
4040
4043
|
paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path));
|
|
4041
4044
|
} else {
|
|
4042
4045
|
if (!this._readyCount) this._readyCount = 0;
|
package/dist/shared/parseAst.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.11.0
|
|
4
|
+
Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -302,7 +302,7 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
302
302
|
}
|
|
303
303
|
// Error codes should be sorted alphabetically while errors should be sorted by
|
|
304
304
|
// error code below
|
|
305
|
-
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_ARGUMENT_NAME = 'DUPLICATE_ARGUMENT_NAME', DUPLICATE_EXPORT = 'DUPLICATE_EXPORT', DUPLICATE_IMPORT_OPTIONS = 'DUPLICATE_IMPORT_OPTIONS', DUPLICATE_PLUGIN_NAME = 'DUPLICATE_PLUGIN_NAME', EMPTY_BUNDLE = 'EMPTY_BUNDLE', EVAL = 'EVAL', EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS = 'EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS', EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES = 'EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES', EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', FAIL_AFTER_WARNINGS = 'FAIL_AFTER_WARNINGS', FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', FILE_NOT_FOUND = 'FILE_NOT_FOUND', FIRST_SIDE_EFFECT = 'FIRST_SIDE_EFFECT', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT', INCONSISTENT_IMPORT_ATTRIBUTES = 'INCONSISTENT_IMPORT_ATTRIBUTES', INVALID_ANNOTATION = 'INVALID_ANNOTATION', INPUT_HOOK_IN_OUTPUT_PLUGIN = 'INPUT_HOOK_IN_OUTPUT_PLUGIN', INVALID_CHUNK = 'INVALID_CHUNK', INVALID_CONFIG_MODULE_FORMAT = 'INVALID_CONFIG_MODULE_FORMAT', INVALID_EXPORT_OPTION = 'INVALID_EXPORT_OPTION', INVALID_EXTERNAL_ID = 'INVALID_EXTERNAL_ID', INVALID_IMPORT_ATTRIBUTE = 'INVALID_IMPORT_ATTRIBUTE', INVALID_LOG_POSITION = 'INVALID_LOG_POSITION', INVALID_OPTION = 'INVALID_OPTION', INVALID_PLUGIN_HOOK = 'INVALID_PLUGIN_HOOK', INVALID_ROLLUP_PHASE = 'INVALID_ROLLUP_PHASE', INVALID_SETASSETSOURCE = 'INVALID_SETASSETSOURCE', INVALID_TLA_FORMAT = 'INVALID_TLA_FORMAT', MISSING_CONFIG = 'MISSING_CONFIG', MISSING_EXPORT = 'MISSING_EXPORT', MISSING_EXTERNAL_CONFIG = 'MISSING_EXTERNAL_CONFIG', MISSING_GLOBAL_NAME = 'MISSING_GLOBAL_NAME', MISSING_IMPLICIT_DEPENDANT = 'MISSING_IMPLICIT_DEPENDANT', MISSING_NAME_OPTION_FOR_IIFE_EXPORT = 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', MISSING_NODE_BUILTINS = 'MISSING_NODE_BUILTINS', MISSING_OPTION = 'MISSING_OPTION', MIXED_EXPORTS = 'MIXED_EXPORTS', MODULE_LEVEL_DIRECTIVE = 'MODULE_LEVEL_DIRECTIVE', NAMESPACE_CONFLICT = 'NAMESPACE_CONFLICT', NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE = 'NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE', ONLY_INLINE_SOURCEMAPS = 'ONLY_INLINE_SOURCEMAPS', OPTIMIZE_CHUNK_STATUS = 'OPTIMIZE_CHUNK_STATUS', PARSE_ERROR = 'PARSE_ERROR', PLUGIN_ERROR = 'PLUGIN_ERROR', REDECLARATION_ERROR = 'REDECLARATION_ERROR', SHIMMED_EXPORT = 'SHIMMED_EXPORT', SOURCEMAP_BROKEN = 'SOURCEMAP_BROKEN', SOURCEMAP_ERROR = 'SOURCEMAP_ERROR', SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', THIS_IS_UNDEFINED = 'THIS_IS_UNDEFINED', UNEXPECTED_NAMED_IMPORT = 'UNEXPECTED_NAMED_IMPORT', UNKNOWN_OPTION = 'UNKNOWN_OPTION', UNRESOLVED_ENTRY = 'UNRESOLVED_ENTRY', UNRESOLVED_IMPORT = 'UNRESOLVED_IMPORT', UNUSED_EXTERNAL_IMPORT = 'UNUSED_EXTERNAL_IMPORT', VALIDATION_ERROR = 'VALIDATION_ERROR';
|
|
305
|
+
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CONST_REASSIGN = 'CONST_REASSIGN', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_ARGUMENT_NAME = 'DUPLICATE_ARGUMENT_NAME', DUPLICATE_EXPORT = 'DUPLICATE_EXPORT', DUPLICATE_IMPORT_OPTIONS = 'DUPLICATE_IMPORT_OPTIONS', DUPLICATE_PLUGIN_NAME = 'DUPLICATE_PLUGIN_NAME', EMPTY_BUNDLE = 'EMPTY_BUNDLE', EVAL = 'EVAL', EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS = 'EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS', EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES = 'EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES', EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', FAIL_AFTER_WARNINGS = 'FAIL_AFTER_WARNINGS', FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', FILE_NOT_FOUND = 'FILE_NOT_FOUND', FIRST_SIDE_EFFECT = 'FIRST_SIDE_EFFECT', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT', INCONSISTENT_IMPORT_ATTRIBUTES = 'INCONSISTENT_IMPORT_ATTRIBUTES', INVALID_ANNOTATION = 'INVALID_ANNOTATION', INPUT_HOOK_IN_OUTPUT_PLUGIN = 'INPUT_HOOK_IN_OUTPUT_PLUGIN', INVALID_CHUNK = 'INVALID_CHUNK', INVALID_CONFIG_MODULE_FORMAT = 'INVALID_CONFIG_MODULE_FORMAT', INVALID_EXPORT_OPTION = 'INVALID_EXPORT_OPTION', INVALID_EXTERNAL_ID = 'INVALID_EXTERNAL_ID', INVALID_IMPORT_ATTRIBUTE = 'INVALID_IMPORT_ATTRIBUTE', INVALID_LOG_POSITION = 'INVALID_LOG_POSITION', INVALID_OPTION = 'INVALID_OPTION', INVALID_PLUGIN_HOOK = 'INVALID_PLUGIN_HOOK', INVALID_ROLLUP_PHASE = 'INVALID_ROLLUP_PHASE', INVALID_SETASSETSOURCE = 'INVALID_SETASSETSOURCE', INVALID_TLA_FORMAT = 'INVALID_TLA_FORMAT', MISSING_CONFIG = 'MISSING_CONFIG', MISSING_EXPORT = 'MISSING_EXPORT', MISSING_EXTERNAL_CONFIG = 'MISSING_EXTERNAL_CONFIG', MISSING_GLOBAL_NAME = 'MISSING_GLOBAL_NAME', MISSING_IMPLICIT_DEPENDANT = 'MISSING_IMPLICIT_DEPENDANT', MISSING_NAME_OPTION_FOR_IIFE_EXPORT = 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', MISSING_NODE_BUILTINS = 'MISSING_NODE_BUILTINS', MISSING_OPTION = 'MISSING_OPTION', MIXED_EXPORTS = 'MIXED_EXPORTS', MODULE_LEVEL_DIRECTIVE = 'MODULE_LEVEL_DIRECTIVE', NAMESPACE_CONFLICT = 'NAMESPACE_CONFLICT', NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE = 'NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE', ONLY_INLINE_SOURCEMAPS = 'ONLY_INLINE_SOURCEMAPS', OPTIMIZE_CHUNK_STATUS = 'OPTIMIZE_CHUNK_STATUS', PARSE_ERROR = 'PARSE_ERROR', PLUGIN_ERROR = 'PLUGIN_ERROR', REDECLARATION_ERROR = 'REDECLARATION_ERROR', SHIMMED_EXPORT = 'SHIMMED_EXPORT', SOURCEMAP_BROKEN = 'SOURCEMAP_BROKEN', SOURCEMAP_ERROR = 'SOURCEMAP_ERROR', SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', THIS_IS_UNDEFINED = 'THIS_IS_UNDEFINED', UNEXPECTED_NAMED_IMPORT = 'UNEXPECTED_NAMED_IMPORT', UNKNOWN_OPTION = 'UNKNOWN_OPTION', UNRESOLVED_ENTRY = 'UNRESOLVED_ENTRY', UNRESOLVED_IMPORT = 'UNRESOLVED_IMPORT', UNUSED_EXTERNAL_IMPORT = 'UNUSED_EXTERNAL_IMPORT', VALIDATION_ERROR = 'VALIDATION_ERROR';
|
|
306
306
|
function logAddonNotGenerated(message, hook, plugin) {
|
|
307
307
|
return {
|
|
308
308
|
code: ADDON_ERROR,
|
|
@@ -418,6 +418,12 @@ function logDeprecation(deprecation, urlSnippet, plugin) {
|
|
|
418
418
|
...(plugin ? { plugin } : {})
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
|
+
function logConstVariableReassignError() {
|
|
422
|
+
return {
|
|
423
|
+
code: CONST_REASSIGN,
|
|
424
|
+
message: 'Cannot reassign a variable declared with `const`'
|
|
425
|
+
};
|
|
426
|
+
}
|
|
421
427
|
function logDuplicateArgumentNameError(name) {
|
|
422
428
|
return { code: DUPLICATE_ARGUMENT_NAME, message: `Duplicate argument name "${name}"` };
|
|
423
429
|
}
|
|
@@ -1034,6 +1040,10 @@ const nodeConverters = [
|
|
|
1034
1040
|
const message = convertString(position, buffer, readString);
|
|
1035
1041
|
error(logParseError(message, pos));
|
|
1036
1042
|
},
|
|
1043
|
+
function panicError(position, buffer, readString) {
|
|
1044
|
+
const message = convertString(position, buffer, readString);
|
|
1045
|
+
error(logParseError(message));
|
|
1046
|
+
},
|
|
1037
1047
|
function arrayExpression(position, buffer, readString) {
|
|
1038
1048
|
const start = buffer[position++];
|
|
1039
1049
|
const end = buffer[position++];
|
|
@@ -2229,6 +2239,7 @@ exports.logChunkNotGeneratedForFileName = logChunkNotGeneratedForFileName;
|
|
|
2229
2239
|
exports.logCircularDependency = logCircularDependency;
|
|
2230
2240
|
exports.logCircularReexport = logCircularReexport;
|
|
2231
2241
|
exports.logConflictingSourcemapSources = logConflictingSourcemapSources;
|
|
2242
|
+
exports.logConstVariableReassignError = logConstVariableReassignError;
|
|
2232
2243
|
exports.logCyclicCrossChunkReexport = logCyclicCrossChunkReexport;
|
|
2233
2244
|
exports.logDuplicateArgumentNameError = logDuplicateArgumentNameError;
|
|
2234
2245
|
exports.logDuplicateExportError = logDuplicateExportError;
|
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.11.0
|
|
4
|
+
Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version = "4.
|
|
34
|
+
var version = "4.11.0";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -51,21 +51,23 @@ var BuildPhase;
|
|
|
51
51
|
})(BuildPhase || (BuildPhase = {}));
|
|
52
52
|
|
|
53
53
|
let textEncoder;
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const getHash64 = input => native_js.xxhashBase64Url(ensureBuffer(input));
|
|
55
|
+
const getHash36 = input => native_js.xxhashBase36(ensureBuffer(input));
|
|
56
|
+
const getHash16 = input => native_js.xxhashBase16(ensureBuffer(input));
|
|
57
|
+
const hasherByType = {
|
|
58
|
+
base36: getHash36,
|
|
59
|
+
base64: getHash64,
|
|
60
|
+
hex: getHash16
|
|
61
|
+
};
|
|
62
|
+
function ensureBuffer(input) {
|
|
56
63
|
if (typeof input === 'string') {
|
|
57
64
|
if (typeof Buffer === 'undefined') {
|
|
58
65
|
textEncoder ??= new TextEncoder();
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
buffer = Buffer.from(input);
|
|
66
|
+
return textEncoder.encode(input);
|
|
63
67
|
}
|
|
68
|
+
return Buffer.from(input);
|
|
64
69
|
}
|
|
65
|
-
|
|
66
|
-
buffer = input;
|
|
67
|
-
}
|
|
68
|
-
return native_js.xxhashBase64Url(buffer);
|
|
70
|
+
return input;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
function getOrCreate(map, key, init) {
|
|
@@ -102,13 +104,13 @@ const hashPlaceholderLeft = '!~{';
|
|
|
102
104
|
const hashPlaceholderRight = '}~';
|
|
103
105
|
const hashPlaceholderOverhead = hashPlaceholderLeft.length + hashPlaceholderRight.length;
|
|
104
106
|
// This is the size of a 128-bits xxhash with base64url encoding
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
+
const MAX_HASH_SIZE = 22;
|
|
108
|
+
const DEFAULT_HASH_SIZE = 8;
|
|
107
109
|
const getHashPlaceholderGenerator = () => {
|
|
108
110
|
let nextIndex = 0;
|
|
109
|
-
return (optionName, hashSize
|
|
110
|
-
if (hashSize >
|
|
111
|
-
return parseAst_js.error(parseAst_js.logFailedValidation(`Hashes cannot be longer than ${
|
|
111
|
+
return (optionName, hashSize) => {
|
|
112
|
+
if (hashSize > MAX_HASH_SIZE) {
|
|
113
|
+
return parseAst_js.error(parseAst_js.logFailedValidation(`Hashes cannot be longer than ${MAX_HASH_SIZE} characters, received ${hashSize}. Check the "${optionName}" option.`));
|
|
112
114
|
}
|
|
113
115
|
const placeholder = `${hashPlaceholderLeft}${toBase64(++nextIndex).padStart(hashSize - hashPlaceholderOverhead, '0')}${hashPlaceholderRight}`;
|
|
114
116
|
if (placeholder.length > hashSize) {
|
|
@@ -117,7 +119,7 @@ const getHashPlaceholderGenerator = () => {
|
|
|
117
119
|
return placeholder;
|
|
118
120
|
};
|
|
119
121
|
};
|
|
120
|
-
const REPLACER_REGEX = new RegExp(`${hashPlaceholderLeft}[0-9a-zA-Z_$]{1,${
|
|
122
|
+
const REPLACER_REGEX = new RegExp(`${hashPlaceholderLeft}[0-9a-zA-Z_$]{1,${MAX_HASH_SIZE - hashPlaceholderOverhead}}${hashPlaceholderRight}`, 'g');
|
|
121
123
|
const replacePlaceholders = (code, hashesByPlaceholder) => code.replace(REPLACER_REGEX, placeholder => hashesByPlaceholder.get(placeholder) || placeholder);
|
|
122
124
|
const replaceSinglePlaceholder = (code, placeholder, value) => code.replace(REPLACER_REGEX, match => (match === placeholder ? value : match));
|
|
123
125
|
const replacePlaceholdersWithDefaultAndGetContainedPlaceholders = (code, placeholders) => {
|
|
@@ -208,7 +210,7 @@ function generateAssetFileName(name, source, sourceHash, outputOptions, bundle)
|
|
|
208
210
|
: outputOptions.assetFileNames, 'output.assetFileNames', {
|
|
209
211
|
ext: () => node_path.extname(emittedName).slice(1),
|
|
210
212
|
extname: () => node_path.extname(emittedName),
|
|
211
|
-
hash: size => sourceHash.slice(0, Math.max(0, size ||
|
|
213
|
+
hash: size => sourceHash.slice(0, Math.max(0, size || DEFAULT_HASH_SIZE)),
|
|
212
214
|
name: () => emittedName.slice(0, Math.max(0, emittedName.length - node_path.extname(emittedName).length))
|
|
213
215
|
}), bundle);
|
|
214
216
|
}
|
|
@@ -317,9 +319,11 @@ class FileEmitter {
|
|
|
317
319
|
this.facadeChunkByModule = facadeChunkByModule;
|
|
318
320
|
};
|
|
319
321
|
this.setOutputBundle = (bundle, outputOptions) => {
|
|
322
|
+
const getHash = hasherByType[outputOptions.hashCharacters];
|
|
320
323
|
const output = (this.output = {
|
|
321
324
|
bundle,
|
|
322
325
|
fileNamesBySource: new Map(),
|
|
326
|
+
getHash,
|
|
323
327
|
outputOptions
|
|
324
328
|
});
|
|
325
329
|
for (const emittedFile of this.filesByReferenceId.values()) {
|
|
@@ -334,7 +338,7 @@ class FileEmitter {
|
|
|
334
338
|
this.finalizeAdditionalAsset(consumedFile, consumedFile.source, output);
|
|
335
339
|
}
|
|
336
340
|
else {
|
|
337
|
-
const sourceHash =
|
|
341
|
+
const sourceHash = getHash(consumedFile.source);
|
|
338
342
|
getOrCreate(consumedAssetsByHash, sourceHash, () => []).push(consumedFile);
|
|
339
343
|
}
|
|
340
344
|
}
|
|
@@ -357,7 +361,7 @@ class FileEmitter {
|
|
|
357
361
|
assignReferenceId(file, idBase) {
|
|
358
362
|
let referenceId = idBase;
|
|
359
363
|
do {
|
|
360
|
-
referenceId =
|
|
364
|
+
referenceId = getHash64(referenceId).slice(0, 8).replaceAll('-', '$');
|
|
361
365
|
} while (this.filesByReferenceId.has(referenceId) ||
|
|
362
366
|
this.outputFileEmitters.some(({ filesByReferenceId }) => filesByReferenceId.has(referenceId)));
|
|
363
367
|
file.referenceId = referenceId;
|
|
@@ -468,11 +472,11 @@ class FileEmitter {
|
|
|
468
472
|
}
|
|
469
473
|
return referenceId;
|
|
470
474
|
}
|
|
471
|
-
finalizeAdditionalAsset(consumedFile, source, { bundle, fileNamesBySource, outputOptions }) {
|
|
475
|
+
finalizeAdditionalAsset(consumedFile, source, { bundle, fileNamesBySource, getHash, outputOptions }) {
|
|
472
476
|
let { fileName, needsCodeReference, referenceId } = consumedFile;
|
|
473
477
|
// Deduplicate assets if an explicit fileName is not provided
|
|
474
478
|
if (!fileName) {
|
|
475
|
-
const sourceHash =
|
|
479
|
+
const sourceHash = getHash(source);
|
|
476
480
|
fileName = fileNamesBySource.get(sourceHash);
|
|
477
481
|
if (!fileName) {
|
|
478
482
|
fileName = generateAssetFileName(consumedFile.name, source, sourceHash, outputOptions, bundle);
|
|
@@ -1275,6 +1279,7 @@ async function mergeOutputOptions(config, overrides, log) {
|
|
|
1275
1279
|
freeze: getOption('freeze'),
|
|
1276
1280
|
generatedCode: getObjectOption(config, overrides, 'generatedCode', objectifyOptionWithPresets(generatedCodePresets, 'output.generatedCode', parseAst_js.URL_OUTPUT_GENERATEDCODE, '')),
|
|
1277
1281
|
globals: getOption('globals'),
|
|
1282
|
+
hashCharacters: getOption('hashCharacters'),
|
|
1278
1283
|
hoistTransitiveImports: getOption('hoistTransitiveImports'),
|
|
1279
1284
|
indent: getOption('indent'),
|
|
1280
1285
|
inlineDynamicImports: getOption('inlineDynamicImports'),
|
|
@@ -1289,6 +1294,7 @@ async function mergeOutputOptions(config, overrides, log) {
|
|
|
1289
1294
|
plugins: await normalizePluginOption(config.plugins),
|
|
1290
1295
|
preserveModules: getOption('preserveModules'),
|
|
1291
1296
|
preserveModulesRoot: getOption('preserveModulesRoot'),
|
|
1297
|
+
reexportProtoFromExternal: getOption('reexportProtoFromExternal'),
|
|
1292
1298
|
sanitizeFileName: getOption('sanitizeFileName'),
|
|
1293
1299
|
sourcemap: getOption('sourcemap'),
|
|
1294
1300
|
sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
|
|
@@ -1745,6 +1751,16 @@ let Chunk$1 = class Chunk {
|
|
|
1745
1751
|
this.intro = content + this.intro;
|
|
1746
1752
|
}
|
|
1747
1753
|
|
|
1754
|
+
reset() {
|
|
1755
|
+
this.intro = '';
|
|
1756
|
+
this.outro = '';
|
|
1757
|
+
if (this.edited) {
|
|
1758
|
+
this.content = this.original;
|
|
1759
|
+
this.storeName = false;
|
|
1760
|
+
this.edited = false;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1748
1764
|
split(index) {
|
|
1749
1765
|
const sliceIndex = index - this.start;
|
|
1750
1766
|
|
|
@@ -1835,8 +1851,8 @@ let Chunk$1 = class Chunk {
|
|
|
1835
1851
|
};
|
|
1836
1852
|
|
|
1837
1853
|
function getBtoa() {
|
|
1838
|
-
if (typeof
|
|
1839
|
-
return (str) =>
|
|
1854
|
+
if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {
|
|
1855
|
+
return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
1840
1856
|
} else if (typeof Buffer === 'function') {
|
|
1841
1857
|
return (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
1842
1858
|
} else {
|
|
@@ -2513,6 +2529,28 @@ class MagicString {
|
|
|
2513
2529
|
return this;
|
|
2514
2530
|
}
|
|
2515
2531
|
|
|
2532
|
+
reset(start, end) {
|
|
2533
|
+
while (start < 0) start += this.original.length;
|
|
2534
|
+
while (end < 0) end += this.original.length;
|
|
2535
|
+
|
|
2536
|
+
if (start === end) return this;
|
|
2537
|
+
|
|
2538
|
+
if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
|
|
2539
|
+
if (start > end) throw new Error('end must be greater than start');
|
|
2540
|
+
|
|
2541
|
+
this._split(start);
|
|
2542
|
+
this._split(end);
|
|
2543
|
+
|
|
2544
|
+
let chunk = this.byStart[start];
|
|
2545
|
+
|
|
2546
|
+
while (chunk) {
|
|
2547
|
+
chunk.reset();
|
|
2548
|
+
|
|
2549
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
2550
|
+
}
|
|
2551
|
+
return this;
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2516
2554
|
lastChar() {
|
|
2517
2555
|
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
2518
2556
|
let chunk = this.lastChunk;
|
|
@@ -9428,6 +9466,12 @@ class AssignmentExpression extends NodeBase {
|
|
|
9428
9466
|
right.include(context, includeChildrenRecursively);
|
|
9429
9467
|
}
|
|
9430
9468
|
initialise() {
|
|
9469
|
+
if (this.left instanceof Identifier) {
|
|
9470
|
+
const variable = this.scope.variables.get(this.left.name);
|
|
9471
|
+
if (variable?.kind === 'const') {
|
|
9472
|
+
this.scope.context.error(parseAst_js.logConstVariableReassignError(), this.left.start);
|
|
9473
|
+
}
|
|
9474
|
+
}
|
|
9431
9475
|
this.left.setAssignedValue(this.right);
|
|
9432
9476
|
}
|
|
9433
9477
|
render(code, options, { preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
@@ -14202,7 +14246,7 @@ class Module {
|
|
|
14202
14246
|
this.ast.bind();
|
|
14203
14247
|
}
|
|
14204
14248
|
error(properties, pos) {
|
|
14205
|
-
this.addLocationToLogProps(properties, pos);
|
|
14249
|
+
pos !== undefined && this.addLocationToLogProps(properties, pos);
|
|
14206
14250
|
return parseAst_js.error(properties);
|
|
14207
14251
|
}
|
|
14208
14252
|
// sum up the length of all ast nodes that are included
|
|
@@ -15000,7 +15044,7 @@ function getCompleteAmdId(options, chunkId) {
|
|
|
15000
15044
|
return options.id ?? '';
|
|
15001
15045
|
}
|
|
15002
15046
|
|
|
15003
|
-
function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, mechanism = 'return ') {
|
|
15047
|
+
function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal, mechanism = 'return ') {
|
|
15004
15048
|
const { _, getDirectReturnFunction, getFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
15005
15049
|
if (!namedExportsMode) {
|
|
15006
15050
|
return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess)};`;
|
|
@@ -15057,6 +15101,16 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
|
|
|
15057
15101
|
if (specifier.reexported === '*') {
|
|
15058
15102
|
if (exportBlock)
|
|
15059
15103
|
exportBlock += n;
|
|
15104
|
+
if (!specifier.needsLiveBinding && reexportProtoFromExternal) {
|
|
15105
|
+
const protoString = "'__proto__'";
|
|
15106
|
+
exportBlock +=
|
|
15107
|
+
`Object.prototype.hasOwnProperty.call(${name},${_}${protoString})${_}&&${n}` +
|
|
15108
|
+
`${t}!Object.prototype.hasOwnProperty.call(exports,${_}${protoString})${_}&&${n}` +
|
|
15109
|
+
`${t}Object.defineProperty(exports,${_}${protoString},${_}{${n}` +
|
|
15110
|
+
`${t}${t}enumerable:${_}true,${n}` +
|
|
15111
|
+
`${t}${t}value:${_}${name}[${protoString}]${n}` +
|
|
15112
|
+
`${t}});${n}${n}`;
|
|
15113
|
+
}
|
|
15060
15114
|
const copyPropertyIfNecessary = `{${n}${t}if${_}(k${_}!==${_}'default'${_}&&${_}!Object.prototype.hasOwnProperty.call(exports,${_}k))${_}${getDefineProperty(name, specifier.needsLiveBinding, t, snippets)}${s}${n}}`;
|
|
15061
15115
|
exportBlock += `Object.keys(${name}).forEach(${getFunctionIntro(['k'], {
|
|
15062
15116
|
isAsync: false,
|
|
@@ -15140,9 +15194,7 @@ const getDefineProperty = (name, needsLiveBinding, t, { _, getDirectReturnFuncti
|
|
|
15140
15194
|
`${t}${t}enumerable:${_}true,${n}` +
|
|
15141
15195
|
`${t}${t}get:${_}${left}${name}[k]${right}${n}${t}})`);
|
|
15142
15196
|
}
|
|
15143
|
-
return
|
|
15144
|
-
`${t}${t}enumerable:${_}true,${n}` +
|
|
15145
|
-
`${t}${t}value:${_}${name}[k]${n}${t}})${_}:${_}exports[k]${_}=${_}${name}[k]`);
|
|
15197
|
+
return `exports[k]${_}=${_}${name}[k]`;
|
|
15146
15198
|
};
|
|
15147
15199
|
|
|
15148
15200
|
function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, indent, snippets) {
|
|
@@ -15287,7 +15339,7 @@ function warnOnBuiltins(log, dependencies) {
|
|
|
15287
15339
|
log(parseAst_js.LOGLEVEL_WARN, parseAst_js.logMissingNodeBuiltins(externalBuiltins));
|
|
15288
15340
|
}
|
|
15289
15341
|
|
|
15290
|
-
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, log, outro, snippets }, { amd, esModule, externalLiveBindings, freeze, generatedCode: { symbols }, interop, strict }) {
|
|
15342
|
+
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, log, outro, snippets }, { amd, esModule, externalLiveBindings, freeze, generatedCode: { symbols }, interop, reexportProtoFromExternal, strict }) {
|
|
15291
15343
|
warnOnBuiltins(log, dependencies);
|
|
15292
15344
|
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
15293
15345
|
const parameters = dependencies.map(m => m.name);
|
|
@@ -15309,7 +15361,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
15309
15361
|
(deps.length > 0 ? `[${deps.join(`,${_}`)}],${_}` : ``);
|
|
15310
15362
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
15311
15363
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
15312
|
-
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
15364
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
15313
15365
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && symbols, snippets);
|
|
15314
15366
|
if (namespaceMarkers) {
|
|
15315
15367
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -15326,7 +15378,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
15326
15378
|
.append(`${n}${n}}));`);
|
|
15327
15379
|
}
|
|
15328
15380
|
|
|
15329
|
-
function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, generatedCode: { symbols }, strict }) {
|
|
15381
|
+
function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, generatedCode: { symbols }, reexportProtoFromExternal, strict }) {
|
|
15330
15382
|
const { _, n } = snippets;
|
|
15331
15383
|
const useStrict = strict ? `'use strict';${n}${n}` : '';
|
|
15332
15384
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && symbols, snippets);
|
|
@@ -15336,7 +15388,7 @@ function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
15336
15388
|
const importBlock = getImportBlock$1(dependencies, snippets, compact);
|
|
15337
15389
|
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets);
|
|
15338
15390
|
magicString.prepend(`${useStrict}${intro}${namespaceMarkers}${importBlock}${interopBlock}`);
|
|
15339
|
-
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, `module.exports${_}=${_}`);
|
|
15391
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal, `module.exports${_}=${_}`);
|
|
15340
15392
|
magicString.append(`${exportBlock}${outro}`);
|
|
15341
15393
|
}
|
|
15342
15394
|
function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
|
|
@@ -15515,7 +15567,7 @@ function trimEmptyImports(dependencies) {
|
|
|
15515
15567
|
return [];
|
|
15516
15568
|
}
|
|
15517
15569
|
|
|
15518
|
-
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, namedExportsMode, log, outro, snippets }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, generatedCode: { symbols }, strict }) {
|
|
15570
|
+
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, namedExportsMode, log, outro, snippets }, { compact, esModule, extend, freeze, externalLiveBindings, reexportProtoFromExternal, globals, interop, name, generatedCode: { symbols }, strict }) {
|
|
15519
15571
|
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
15520
15572
|
const isNamespaced = name && name.includes('.');
|
|
15521
15573
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
@@ -15560,7 +15612,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultE
|
|
|
15560
15612
|
if (hasExports && !extend && namedExportsMode) {
|
|
15561
15613
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
15562
15614
|
}
|
|
15563
|
-
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
15615
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
15564
15616
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
15565
15617
|
if (namespaceMarkers) {
|
|
15566
15618
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -15733,7 +15785,7 @@ function safeAccess(name, globalVariable, { _, getPropertyAccess }) {
|
|
|
15733
15785
|
.map(part => (propertyPath += getPropertyAccess(part)))
|
|
15734
15786
|
.join(`${_}&&${_}`);
|
|
15735
15787
|
}
|
|
15736
|
-
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, log, outro, snippets }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name, generatedCode: { symbols }, globals, noConflict, strict }) {
|
|
15788
|
+
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, log, outro, snippets }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name, generatedCode: { symbols }, globals, noConflict, reexportProtoFromExternal, strict }) {
|
|
15737
15789
|
const { _, cnst, getFunctionIntro, getNonArrowFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
15738
15790
|
const factoryVariable = compact ? 'f' : 'factory';
|
|
15739
15791
|
const globalVariable = compact ? 'g' : 'global';
|
|
@@ -15814,7 +15866,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
15814
15866
|
})}{${useStrict}${n}`;
|
|
15815
15867
|
const wrapperOutro = n + n + '}));';
|
|
15816
15868
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
15817
|
-
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
15869
|
+
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, reexportProtoFromExternal);
|
|
15818
15870
|
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
15819
15871
|
if (namespaceMarkers) {
|
|
15820
15872
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
@@ -16379,7 +16431,8 @@ class Chunk {
|
|
|
16379
16431
|
: [chunkFileNames, 'output.chunkFileNames'];
|
|
16380
16432
|
fileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getPreRenderedChunkInfo()) : pattern, patternName, {
|
|
16381
16433
|
format: () => format,
|
|
16382
|
-
hash: size => hashPlaceholder ||
|
|
16434
|
+
hash: size => hashPlaceholder ||
|
|
16435
|
+
(hashPlaceholder = this.getPlaceholder(patternName, size || DEFAULT_HASH_SIZE)),
|
|
16383
16436
|
name: () => this.getChunkName()
|
|
16384
16437
|
});
|
|
16385
16438
|
if (!hashPlaceholder) {
|
|
@@ -16407,7 +16460,8 @@ class Chunk {
|
|
|
16407
16460
|
sourcemapFileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getPreRenderedChunkInfo()) : pattern, patternName, {
|
|
16408
16461
|
chunkhash: () => this.getPreliminaryFileName().hashPlaceholder || '',
|
|
16409
16462
|
format: () => format,
|
|
16410
|
-
hash: size => hashPlaceholder ||
|
|
16463
|
+
hash: size => hashPlaceholder ||
|
|
16464
|
+
(hashPlaceholder = this.getPlaceholder(patternName, size || DEFAULT_HASH_SIZE)),
|
|
16411
16465
|
name: () => this.getChunkName()
|
|
16412
16466
|
});
|
|
16413
16467
|
if (!hashPlaceholder) {
|
|
@@ -18116,9 +18170,10 @@ async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
|
|
|
18116
18170
|
const renderedChunks = await Promise.all(chunks.map(chunk => chunk.render()));
|
|
18117
18171
|
timeEnd('render chunks', 2);
|
|
18118
18172
|
timeStart('transform chunks', 2);
|
|
18173
|
+
const getHash = hasherByType[outputOptions.hashCharacters];
|
|
18119
18174
|
const chunkGraph = getChunkGraph(chunks);
|
|
18120
|
-
const { initialHashesByPlaceholder, nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log);
|
|
18121
|
-
const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle);
|
|
18175
|
+
const { initialHashesByPlaceholder, nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, getHash, log);
|
|
18176
|
+
const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle, getHash);
|
|
18122
18177
|
addChunksToBundle(renderedChunksByPlaceholder, hashesByPlaceholder, bundle, nonHashedChunksWithPlaceholders, pluginDriver, outputOptions);
|
|
18123
18178
|
timeEnd('transform chunks', 2);
|
|
18124
18179
|
}
|
|
@@ -18198,7 +18253,7 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
18198
18253
|
map
|
|
18199
18254
|
};
|
|
18200
18255
|
}
|
|
18201
|
-
async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log) {
|
|
18256
|
+
async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, getHash, log) {
|
|
18202
18257
|
const nonHashedChunksWithPlaceholders = [];
|
|
18203
18258
|
const renderedChunksByPlaceholder = new Map();
|
|
18204
18259
|
const hashDependenciesByPlaceholder = new Map();
|
|
@@ -18233,7 +18288,7 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
|
|
|
18233
18288
|
renderedChunksByPlaceholder.set(hashPlaceholder, transformedChunk);
|
|
18234
18289
|
hashDependenciesByPlaceholder.set(hashPlaceholder, {
|
|
18235
18290
|
containedPlaceholders,
|
|
18236
|
-
contentHash:
|
|
18291
|
+
contentHash: getHash(contentToHash)
|
|
18237
18292
|
});
|
|
18238
18293
|
}
|
|
18239
18294
|
else {
|
|
@@ -18241,7 +18296,7 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
|
|
|
18241
18296
|
}
|
|
18242
18297
|
const sourcemapHashPlaceholder = preliminarySourcemapFileName?.hashPlaceholder;
|
|
18243
18298
|
if (map && sourcemapHashPlaceholder) {
|
|
18244
|
-
initialHashesByPlaceholder.set(preliminarySourcemapFileName.hashPlaceholder,
|
|
18299
|
+
initialHashesByPlaceholder.set(preliminarySourcemapFileName.hashPlaceholder, getHash(map.toString()).slice(0, preliminarySourcemapFileName.hashPlaceholder.length));
|
|
18245
18300
|
}
|
|
18246
18301
|
}));
|
|
18247
18302
|
return {
|
|
@@ -18251,7 +18306,7 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
|
|
|
18251
18306
|
renderedChunksByPlaceholder
|
|
18252
18307
|
};
|
|
18253
18308
|
}
|
|
18254
|
-
function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle) {
|
|
18309
|
+
function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle, getHash) {
|
|
18255
18310
|
const hashesByPlaceholder = new Map(initialHashesByPlaceholder);
|
|
18256
18311
|
for (const [placeholder, { fileName }] of renderedChunksByPlaceholder) {
|
|
18257
18312
|
let contentToHash = '';
|
|
@@ -18271,7 +18326,7 @@ function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlac
|
|
|
18271
18326
|
if (finalHash) {
|
|
18272
18327
|
contentToHash = finalHash;
|
|
18273
18328
|
}
|
|
18274
|
-
finalHash =
|
|
18329
|
+
finalHash = getHash(contentToHash).slice(0, placeholder.length);
|
|
18275
18330
|
finalFileName = replaceSinglePlaceholder(fileName, placeholder, finalHash);
|
|
18276
18331
|
} while (bundle[lowercaseBundleKeys].has(finalFileName.toLowerCase()));
|
|
18277
18332
|
bundle[finalFileName] = FILE_PLACEHOLDER;
|
|
@@ -19636,6 +19691,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
19636
19691
|
freeze: config.freeze ?? true,
|
|
19637
19692
|
generatedCode,
|
|
19638
19693
|
globals: config.globals || {},
|
|
19694
|
+
hashCharacters: config.hashCharacters ?? 'base64',
|
|
19639
19695
|
hoistTransitiveImports: config.hoistTransitiveImports ?? true,
|
|
19640
19696
|
indent: getIndent(config, compact),
|
|
19641
19697
|
inlineDynamicImports,
|
|
@@ -19650,6 +19706,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
19650
19706
|
plugins: await normalizePluginOption(config.plugins),
|
|
19651
19707
|
preserveModules,
|
|
19652
19708
|
preserveModulesRoot: getPreserveModulesRoot(config),
|
|
19709
|
+
reexportProtoFromExternal: config.reexportProtoFromExternal ?? true,
|
|
19653
19710
|
sanitizeFileName: typeof config.sanitizeFileName === 'function'
|
|
19654
19711
|
? config.sanitizeFileName
|
|
19655
19712
|
: config.sanitizeFileName === false
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED