@visulima/packem-rollup 1.0.0-alpha.3 → 1.0.0-alpha.30
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/CHANGELOG.md +267 -0
- package/LICENSE.md +199 -590
- package/README.md +89 -2
- package/dist/index.d.ts +24 -56
- package/dist/index.js +1 -0
- package/dist/packem_shared/cachingPlugin-CLawAGhx.js +1 -0
- package/dist/packem_shared/createSplitChunks-Ceq_Ca5Y.js +1 -0
- package/dist/packem_shared/esbuildPlugin-DpLtQGuZ.js +1 -0
- package/dist/packem_shared/index-QEzU3Fey.js +1 -0
- package/dist/packem_shared/{metafilePlugin-ObS4J7mO.mjs → metafilePlugin-CVcqFpPJ.js} +1 -1
- package/dist/packem_shared/oxcResolvePlugin-Ccef6pyL.js +1 -0
- package/dist/packem_shared/{patchTypescriptTypes-BEdkvKxL.mjs → patchTypescriptTypes-BX_sJsvd.js} +2 -2
- package/dist/packem_shared/resolveTsconfigPathsPlugin-CEasmDpi.js +1 -0
- package/dist/packem_shared/{resolveTsconfigRootDirectoriesPlugin-_93afm2q.mjs → resolveTsconfigRootDirectoriesPlugin-Cwj3tqCJ.js} +1 -1
- package/dist/plugins/cache-plugin.d.ts +11 -0
- package/dist/plugins/chunk-splitter/gather.d.ts +8 -0
- package/dist/plugins/chunk-splitter/index.d.ts +6 -0
- package/dist/plugins/chunk-splitter/parse/index.d.ts +4 -0
- package/dist/plugins/chunk-splitter/parse/types.d.ts +24 -0
- package/dist/plugins/cjs-interop.d.ts +7 -0
- package/dist/{packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs → plugins/cjs-interop.js} +1 -1
- package/dist/plugins/copy.d.ts +23 -0
- package/dist/plugins/copy.js +1 -0
- package/dist/plugins/data-uri.d.ts +25 -0
- package/dist/plugins/data-uri.js +1 -0
- package/dist/plugins/debarrel.d.ts +7 -0
- package/dist/plugins/debarrel.js +2 -0
- package/dist/{packem_shared/browserslist-to-esbuild-DY9HwYtp.d.mts → plugins/esbuild/browserslist-to-esbuild.d.ts} +1 -2
- package/dist/plugins/esbuild/esbuild-plugin.d.ts +3 -0
- package/dist/plugins/esbuild/index.d.ts +3 -25
- package/dist/plugins/esbuild/index.js +1 -0
- package/dist/plugins/esbuild/types.d.ts +39 -0
- package/dist/plugins/esbuild/utils/get-render-chunk.d.ts +14 -0
- package/dist/plugins/esbuild/utils/optimize-deps.d.ts +3 -0
- package/dist/plugins/esbuild/utils/warn.d.ts +4 -0
- package/dist/plugins/esm-shim-cjs-syntax.d.ts +9 -0
- package/dist/plugins/fix-dts-default-cjs-exports.d.ts +26 -0
- package/dist/plugins/fix-dts-default-cjs-exports.js +1 -0
- package/dist/plugins/fix-dynamic-import-extension.d.ts +3 -0
- package/dist/plugins/isolated-declarations/index.d.ts +8 -0
- package/dist/plugins/isolated-declarations/index.js +3 -0
- package/dist/plugins/isolated-declarations/utils/extend-string.d.ts +2 -0
- package/dist/plugins/isolated-declarations/utils/fix-dts-default-cjs-exports.d.ts +35 -0
- package/dist/plugins/isolated-declarations/utils/lowest-common-ancestor.d.ts +2 -0
- package/dist/plugins/isolated-declarations/utils/split-tsconfig-path-key.d.ts +2 -0
- package/dist/plugins/json.d.ts +4 -0
- package/dist/plugins/json.js +1 -0
- package/dist/plugins/jsx-remove-attributes.d.ts +7 -0
- package/dist/plugins/jsx-remove-attributes.js +1 -0
- package/dist/plugins/license.d.ts +17 -0
- package/dist/plugins/license.js +13 -0
- package/dist/plugins/metafile.d.ts +3 -0
- package/dist/plugins/minify-html-literals/index.d.ts +41 -0
- package/dist/plugins/minify-html-literals/index.js +3 -0
- package/dist/plugins/minify-html-literals/lib/minify-html-literals.d.ts +200 -0
- package/dist/plugins/minify-html-literals/lib/models.d.ts +25 -0
- package/dist/plugins/minify-html-literals/lib/parse-literals.d.ts +13 -0
- package/dist/plugins/minify-html-literals/lib/strategy.d.ts +69 -0
- package/dist/plugins/minify-html-literals/lib/typescript.d.ts +23 -0
- package/dist/plugins/native-modules-plugin.d.ts +14 -0
- package/dist/plugins/native-modules-plugin.js +1 -0
- package/dist/plugins/oxc/index.d.ts +4 -28
- package/dist/plugins/oxc/index.js +1 -0
- package/dist/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +4 -0
- package/dist/plugins/oxc/oxc-resolve-plugin.d.ts +4 -0
- package/dist/plugins/oxc/oxc-transformer-plugin.d.ts +3 -0
- package/dist/plugins/oxc/types.d.ts +16 -0
- package/dist/plugins/preserve-directives.d.ts +16 -0
- package/dist/{packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs → plugins/preserve-directives.js} +3 -3
- package/dist/plugins/raw.d.ts +7 -0
- package/dist/plugins/raw.js +6 -0
- package/dist/plugins/require-cjs-transformer.d.ts +43 -0
- package/dist/plugins/require-cjs-transformer.js +21 -0
- package/dist/plugins/resolve-file-url.d.ts +3 -0
- package/dist/plugins/shebang.d.ts +9 -0
- package/dist/plugins/source-maps.d.ts +7 -0
- package/dist/plugins/sucrase/index.d.ts +8 -19
- package/dist/plugins/swc/index.d.ts +3 -26
- package/dist/plugins/swc/index.js +1 -0
- package/dist/plugins/swc/isolated-declarations-swc-transformer.d.ts +3 -0
- package/dist/plugins/swc/swc-plugin.d.ts +3 -0
- package/dist/plugins/swc/types.d.ts +6 -0
- package/dist/plugins/typescript/index.d.ts +8 -29
- package/dist/plugins/typescript/index.js +1 -0
- package/dist/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +4 -0
- package/dist/plugins/typescript/patch-typescript-types.d.ts +13 -0
- package/dist/plugins/typescript/resolve-tsconfig-paths-plugin.d.ts +11 -0
- package/dist/plugins/typescript/resolve-tsconfig-root-dirs.d.ts +24 -0
- package/dist/plugins/typescript/resolve-typescript-mjs-cjs.d.ts +10 -0
- package/dist/plugins/url.d.ts +72 -0
- package/dist/plugins/url.js +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/utils/chunks/create-split-chunks.d.ts +11 -0
- package/dist/utils/chunks/get-custom-module-layer.d.ts +2 -0
- package/dist/utils/chunks/get-module-layer.d.ts +10 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/is-pure-cjs.d.ts +9 -0
- package/package.json +104 -29
- package/dist/index.d.mts +0 -56
- package/dist/index.mjs +0 -1
- package/dist/packem_shared/browserslist-to-esbuild-DY9HwYtp.d.ts +0 -3
- package/dist/packem_shared/cachingPlugin-D0BBFJPD.mjs +0 -1
- package/dist/packem_shared/copyPlugin--6RITp1-.mjs +0 -1
- package/dist/packem_shared/createSplitChunks-CGDk55G3.mjs +0 -1
- package/dist/packem_shared/esbuildPlugin-BAwyhG6L.mjs +0 -1
- package/dist/packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs +0 -1
- package/dist/packem_shared/isolatedDeclarationsPlugin-A0wmmw3Y.mjs +0 -3
- package/dist/packem_shared/jsonPlugin-BAi3Da-h.mjs +0 -1
- package/dist/packem_shared/jsxRemoveAttributes-B1PLPffj.mjs +0 -1
- package/dist/packem_shared/licensePlugin-C5yzUqe-.mjs +0 -13
- package/dist/packem_shared/oxcResolvePlugin-BJpi-eSG.mjs +0 -1
- package/dist/packem_shared/rawPlugin-BqlR6ZOI.mjs +0 -1
- package/dist/packem_shared/resolveTsconfigPathsPlugin-Crf4lzxq.mjs +0 -1
- package/dist/packem_shared/types-C_grznAP.d.mts +0 -4539
- package/dist/packem_shared/types-C_grznAP.d.ts +0 -4539
- package/dist/packem_shared/urlPlugin-DBgFIkTc.mjs +0 -1
- package/dist/plugins/esbuild/index.d.mts +0 -25
- package/dist/plugins/esbuild/index.mjs +0 -1
- package/dist/plugins/oxc/index.d.mts +0 -28
- package/dist/plugins/oxc/index.mjs +0 -1
- package/dist/plugins/sucrase/index.d.mts +0 -19
- package/dist/plugins/swc/index.d.mts +0 -26
- package/dist/plugins/swc/index.mjs +0 -1
- package/dist/plugins/typescript/index.d.mts +0 -29
- package/dist/plugins/typescript/index.mjs +0 -1
- /package/dist/packem_shared/{browserslistToEsbuild-C0IWmbNe.mjs → browserslistToEsbuild-C0IWmbNe.js} +0 -0
- /package/dist/packem_shared/{chunkSplitter-DWAy1JkE.mjs → chunkSplitter-DWAy1JkE.js} +0 -0
- /package/dist/packem_shared/{fix-dts-default-cjs-exports-BQc0nwIG.mjs → fix-dts-default-cjs-exports-BQc0nwIG.js} +0 -0
- /package/dist/packem_shared/{fixDynamicImportExtension-BBGNRniz.mjs → fixDynamicImportExtension-BBGNRniz.js} +0 -0
- /package/dist/packem_shared/{getCustomModuleLayer-d8i66lfh.mjs → getCustomModuleLayer-d8i66lfh.js} +0 -0
- /package/dist/packem_shared/{getModuleLayer-rF9RxnJ5.mjs → getModuleLayer-rF9RxnJ5.js} +0 -0
- /package/dist/packem_shared/{index-Dq8IUFTs.mjs → index-Dq8IUFTs.js} +0 -0
- /package/dist/packem_shared/{isolatedDeclarationsOxcTransformer-WbfE6cGu.mjs → isolatedDeclarationsOxcTransformer-WbfE6cGu.js} +0 -0
- /package/dist/packem_shared/{isolatedDeclarationsSwcTransformer-Ch2AgtWC.mjs → isolatedDeclarationsSwcTransformer-Ch2AgtWC.js} +0 -0
- /package/dist/packem_shared/{isolatedDeclarationsTypescriptTransformer-DkuEkofo.mjs → isolatedDeclarationsTypescriptTransformer-DkuEkofo.js} +0 -0
- /package/dist/packem_shared/{oxcTransformPlugin-DfVQouIB.mjs → oxcTransformPlugin-DfVQouIB.js} +0 -0
- /package/dist/packem_shared/{resolveFileUrl-BkpjVHeK.mjs → resolveFileUrlPlugin-BkpjVHeK.js} +0 -0
- /package/dist/packem_shared/{resolveTypescriptMjsCtsPlugin-DcZrZTmM.mjs → resolveTypescriptMjsCtsPlugin-DcZrZTmM.js} +0 -0
- /package/dist/packem_shared/{swcPlugin-Boip4lWG.mjs → swcPlugin-Boip4lWG.js} +0 -0
- /package/dist/{packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs → plugins/esm-shim-cjs-syntax.js} +0 -0
- /package/dist/{packem_shared/makeExecutable-6aOVHoJR.mjs → plugins/shebang.js} +0 -0
- /package/dist/{packem_shared/sourcemapsPlugin-B4W3J79w.mjs → plugins/source-maps.js} +0 -0
- /package/dist/plugins/sucrase/{index.mjs → index.js} +0 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { RollupAliasOptions } from "@rollup/plugin-alias";
|
|
2
|
+
import type { RollupCommonJSOptions } from "@rollup/plugin-commonjs";
|
|
3
|
+
import type { RollupJsonOptions } from "@rollup/plugin-json";
|
|
4
|
+
import type { RollupNodeResolveOptions } from "@rollup/plugin-node-resolve";
|
|
5
|
+
import type { RollupReplaceOptions } from "@rollup/plugin-replace";
|
|
6
|
+
import type { RollupWasmOptions } from "@rollup/plugin-wasm";
|
|
7
|
+
import type { FilterPattern } from "@rollup/pluginutils";
|
|
8
|
+
import type { OutputOptions, Plugin, RollupOptions } from "rollup";
|
|
9
|
+
import type { Options as RollupDtsOptions } from "rollup-plugin-dts";
|
|
10
|
+
import type { NodePolyfillsOptions } from "rollup-plugin-polyfill-node";
|
|
11
|
+
import type { PureAnnotationsOptions } from "rollup-plugin-pure";
|
|
12
|
+
import type { PluginVisualizerOptions } from "rollup-plugin-visualizer";
|
|
13
|
+
import type { CJSInteropOptions } from "./plugins/cjs-interop.d.ts";
|
|
14
|
+
import type { CopyPluginOptions } from "./plugins/copy.d.ts";
|
|
15
|
+
import type { DataUriPluginOptions } from "./plugins/data-uri.d.ts";
|
|
16
|
+
import type { DebarrelPluginOptions } from "./plugins/debarrel.d.ts";
|
|
17
|
+
import type { EsbuildPluginConfig, Options as EsbuildOptions } from "./plugins/esbuild/types.d.ts";
|
|
18
|
+
import type { EsmShimCjsSyntaxOptions } from "./plugins/esm-shim-cjs-syntax.d.ts";
|
|
19
|
+
import type { IsolatedDeclarationsOptions } from "./plugins/isolated-declarations/index.d.ts";
|
|
20
|
+
import type { JSXRemoveAttributesPlugin } from "./plugins/jsx-remove-attributes.d.ts";
|
|
21
|
+
import type { LicenseOptions } from "./plugins/license.d.ts";
|
|
22
|
+
import type { MinifyHTMLLiteralsOptions } from "./plugins/minify-html-literals/index.d.ts";
|
|
23
|
+
import type { NativeModulesOptions } from "./plugins/native-modules-plugin.d.ts";
|
|
24
|
+
import type { InternalOXCTransformPluginConfig, OxcResolveOptions, OXCTransformPluginConfig } from "./plugins/oxc/types.d.ts";
|
|
25
|
+
import type { RawLoaderOptions } from "./plugins/raw.d.ts";
|
|
26
|
+
import type { Options as RequireCJSPluginOptions } from "./plugins/require-cjs-transformer.d.ts";
|
|
27
|
+
import type { ShebangOptions } from "./plugins/shebang.d.ts";
|
|
28
|
+
import type { SourcemapsPluginOptions } from "./plugins/source-maps.d.ts";
|
|
29
|
+
import type { SucrasePluginConfig } from "./plugins/sucrase/index.d.ts";
|
|
30
|
+
import type { SwcPluginConfig } from "./plugins/swc/types.d.ts";
|
|
31
|
+
import type { PatchTypesOptions } from "./plugins/typescript/patch-typescript-types.d.ts";
|
|
32
|
+
import type { TsconfigPathsPluginOptions } from "./plugins/typescript/resolve-tsconfig-paths-plugin.d.ts";
|
|
33
|
+
import type { UrlOptions } from "./plugins/url.d.ts";
|
|
34
|
+
interface RollupDynamicImportVariablesOptions {
|
|
35
|
+
/**
|
|
36
|
+
* By default, the plugin will not throw errors when target files are not found.
|
|
37
|
+
* Setting this option to true will result in errors thrown when encountering files which don't exist.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
errorWhenNoFilesFound?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
|
|
43
|
+
* should _ignore_.
|
|
44
|
+
*
|
|
45
|
+
* By default, no files are ignored.
|
|
46
|
+
*/
|
|
47
|
+
exclude?: FilterPattern;
|
|
48
|
+
/**
|
|
49
|
+
* A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
|
|
50
|
+
* should operate on.
|
|
51
|
+
* By default, all files are targeted.
|
|
52
|
+
*/
|
|
53
|
+
include?: FilterPattern;
|
|
54
|
+
/**
|
|
55
|
+
* By default, the plugin quits the build process when it encounters an error.
|
|
56
|
+
* If you set this option to true, it will throw a warning instead and leave the code untouched.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
warnOnError?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface ExtendedRollupNodeResolveOptions extends RollupNodeResolveOptions {
|
|
62
|
+
/**
|
|
63
|
+
* Controls how unresolved import warnings from the node-resolve plugin are handled.
|
|
64
|
+
* - `"error"` (default): Treat unresolved imports as errors, causing the build to fail
|
|
65
|
+
* - `"warn"`: Treat unresolved imports as warnings, allowing the build to continue
|
|
66
|
+
* @default "error"
|
|
67
|
+
*/
|
|
68
|
+
unresolvedImportBehavior?: "error" | "warn";
|
|
69
|
+
}
|
|
70
|
+
export interface IsolatedDeclarationsResult {
|
|
71
|
+
errors: string[];
|
|
72
|
+
map?: string;
|
|
73
|
+
sourceText: string;
|
|
74
|
+
}
|
|
75
|
+
export type IsolatedDeclarationsTransformer = (code: string, id: string, sourceMap?: boolean) => Promise<IsolatedDeclarationsResult>;
|
|
76
|
+
export interface PackemRollupOptions {
|
|
77
|
+
alias?: RollupAliasOptions | false;
|
|
78
|
+
cjsInterop?: CJSInteropOptions;
|
|
79
|
+
commonjs?: RollupCommonJSOptions | false;
|
|
80
|
+
copy?: CopyPluginOptions | false;
|
|
81
|
+
dataUri?: DataUriPluginOptions | false;
|
|
82
|
+
debarrel?: DebarrelPluginOptions | false;
|
|
83
|
+
dts?: RollupDtsOptions;
|
|
84
|
+
dynamicVars?: RollupDynamicImportVariablesOptions | false;
|
|
85
|
+
esbuild?: EsbuildOptions | false;
|
|
86
|
+
experimental?: {
|
|
87
|
+
resolve?: OxcResolveOptions | false;
|
|
88
|
+
};
|
|
89
|
+
isolatedDeclarations?: IsolatedDeclarationsOptions;
|
|
90
|
+
json?: RollupJsonOptions | false;
|
|
91
|
+
jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
|
|
92
|
+
license?: LicenseOptions | false;
|
|
93
|
+
metafile?: boolean;
|
|
94
|
+
minifyHTMLLiterals?: MinifyHTMLLiteralsOptions | false;
|
|
95
|
+
nativeModules?: NativeModulesOptions | false;
|
|
96
|
+
output?: OutputOptions;
|
|
97
|
+
oxc?: Omit<OXCTransformPluginConfig, "cwd" | "sourcemap" | "target"> | false;
|
|
98
|
+
patchTypes?: PatchTypesOptions | false;
|
|
99
|
+
pluginPure?: Omit<PureAnnotationsOptions, "sourcemap"> | false;
|
|
100
|
+
plugins?: RollupPlugins;
|
|
101
|
+
polyfillNode?: NodePolyfillsOptions | false;
|
|
102
|
+
preserveDirectives?: {
|
|
103
|
+
directiveRegex?: RegExp;
|
|
104
|
+
exclude?: FilterPattern;
|
|
105
|
+
include?: FilterPattern;
|
|
106
|
+
};
|
|
107
|
+
preserveDynamicImports?: boolean;
|
|
108
|
+
raw?: RawLoaderOptions | false;
|
|
109
|
+
replace?: Omit<RollupReplaceOptions, "cwd"> | false;
|
|
110
|
+
requireCJS?: RequireCJSPluginOptions | false;
|
|
111
|
+
resolve?: ExtendedRollupNodeResolveOptions | false;
|
|
112
|
+
shebang?: Partial<ShebangOptions> | false;
|
|
113
|
+
shim?: EsmShimCjsSyntaxOptions | false;
|
|
114
|
+
sourcemap?: SourcemapsPluginOptions;
|
|
115
|
+
sucrase?: SucrasePluginConfig | false;
|
|
116
|
+
swc?: SwcPluginConfig | false;
|
|
117
|
+
treeshake?: RollupOptions["treeshake"];
|
|
118
|
+
tsconfigPaths?: TsconfigPathsPluginOptions | false;
|
|
119
|
+
url?: UrlOptions | false;
|
|
120
|
+
visualizer?: PluginVisualizerOptions | false;
|
|
121
|
+
wasm?: RollupWasmOptions | false;
|
|
122
|
+
watch?: RollupOptions["watch"];
|
|
123
|
+
}
|
|
124
|
+
export type RollupPlugins = {
|
|
125
|
+
enforce?: "post" | "pre";
|
|
126
|
+
plugin: Plugin;
|
|
127
|
+
type?: "build" | "dts";
|
|
128
|
+
}[];
|
|
129
|
+
export type TransformerFn = ((config: EsbuildPluginConfig | InternalOXCTransformPluginConfig | SucrasePluginConfig | SwcPluginConfig) => Plugin) & {
|
|
130
|
+
NAME?: TransformerName;
|
|
131
|
+
};
|
|
132
|
+
export type TransformerName = "esbuild" | "oxc" | "sucrase" | "swc";
|
|
133
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/huozhi/bunchee/blob/3cb85160bbad3af229654cc09d6fcd67120fe8bd/src/lib/split-chunk.ts
|
|
3
|
+
*
|
|
4
|
+
* The MIT License (MIT)
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 these people -> https://github.com/huozhi/bunchee/graphs/contributors
|
|
7
|
+
*/
|
|
8
|
+
import type { BuildContextBuildAssetAndChunk, BuildContextBuildEntry } from "@visulima/packem-share/types";
|
|
9
|
+
import type { GetManualChunk } from "rollup";
|
|
10
|
+
declare const createSplitChunks: (dependencyGraphMap: Map<string, Set<[string, string]>>, entryFiles: (BuildContextBuildAssetAndChunk | BuildContextBuildEntry)[]) => GetManualChunk;
|
|
11
|
+
export default createSplitChunks;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/huozhi/bunchee/blob/3cb85160bbad3af229654cc09d6fcd67120fe8bd/src/lib/split-chunk.ts
|
|
3
|
+
*
|
|
4
|
+
* The MIT License (MIT)
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 these people -> https://github.com/huozhi/bunchee/graphs/contributors
|
|
7
|
+
*/
|
|
8
|
+
import type { CustomPluginOptions } from "rollup";
|
|
9
|
+
declare const getModuleLayer: (moduleMeta: CustomPluginOptions) => any;
|
|
10
|
+
export default getModuleLayer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as createSplitChunks } from "./chunks/create-split-chunks.d.ts";
|
|
2
|
+
export { default as getCustomModuleLayer } from "./chunks/get-custom-module-layer.d.ts";
|
|
3
|
+
export { default as getModuleLayer } from "./chunks/get-module-layer.d.ts";
|
|
4
|
+
export { arrayify, enhanceRollupError, FileCache, getChunkFilename, getEntryFileNames, getHash, getPackageName, memoize, memoizeByKey, replaceContentWithinMarker, sortUserPlugins, svgEncoder, } from "@visulima/packem-share/utils";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResolvedId } from "rollup";
|
|
2
|
+
/**
|
|
3
|
+
* Determines if a module is a pure CommonJS module by checking various indicators.
|
|
4
|
+
* @param id The module ID to check
|
|
5
|
+
* @param importer The importer context (can be a file path or Rollup plugin context)
|
|
6
|
+
* @param rollupResolve Optional Rollup resolve function for better module resolution
|
|
7
|
+
*/
|
|
8
|
+
export declare const isPureCJS: (id: string, importer: string, rollupResolve?: (id: string, importer?: string) => Promise<ResolvedId | null>) => Promise<boolean>;
|
|
9
|
+
export default isPureCJS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/packem-rollup",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.30",
|
|
4
4
|
"description": "Rollup plugins for packem",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -34,28 +34,100 @@
|
|
|
34
34
|
"type": "module",
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
|
37
|
-
"types": "./dist/index.d.
|
|
38
|
-
"default": "./dist/index.
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"default": "./dist/index.js"
|
|
39
39
|
},
|
|
40
40
|
"./esbuild": {
|
|
41
|
-
"types": "./dist/plugins/esbuild/index.d.
|
|
42
|
-
"default": "./dist/plugins/esbuild/index.
|
|
41
|
+
"types": "./dist/plugins/esbuild/index.d.ts",
|
|
42
|
+
"default": "./dist/plugins/esbuild/index.js"
|
|
43
43
|
},
|
|
44
44
|
"./swc": {
|
|
45
|
-
"types": "./dist/plugins/swc/index.d.
|
|
46
|
-
"default": "./dist/plugins/swc/index.
|
|
45
|
+
"types": "./dist/plugins/swc/index.d.ts",
|
|
46
|
+
"default": "./dist/plugins/swc/index.js"
|
|
47
47
|
},
|
|
48
48
|
"./typescript": {
|
|
49
|
-
"types": "./dist/plugins/typescript/index.d.
|
|
50
|
-
"default": "./dist/plugins/typescript/index.
|
|
49
|
+
"types": "./dist/plugins/typescript/index.d.ts",
|
|
50
|
+
"default": "./dist/plugins/typescript/index.js"
|
|
51
51
|
},
|
|
52
52
|
"./oxc": {
|
|
53
|
-
"types": "./dist/plugins/oxc/index.d.
|
|
54
|
-
"default": "./dist/plugins/oxc/index.
|
|
53
|
+
"types": "./dist/plugins/oxc/index.d.ts",
|
|
54
|
+
"default": "./dist/plugins/oxc/index.js"
|
|
55
55
|
},
|
|
56
56
|
"./sucrase": {
|
|
57
|
-
"types": "./dist/plugins/sucrase/index.d.
|
|
58
|
-
"default": "./dist/plugins/sucrase/index.
|
|
57
|
+
"types": "./dist/plugins/sucrase/index.d.ts",
|
|
58
|
+
"default": "./dist/plugins/sucrase/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./plugin/minify-html-literals": {
|
|
61
|
+
"types": "./dist/plugins/minify-html-literals/index.d.ts",
|
|
62
|
+
"default": "./dist/plugins/minify-html-literals/index.js"
|
|
63
|
+
},
|
|
64
|
+
"./plugin/require-cjs-transformer": {
|
|
65
|
+
"types": "./dist/plugins/require-cjs-transformer.d.ts",
|
|
66
|
+
"default": "./dist/plugins/require-cjs-transformer.js"
|
|
67
|
+
},
|
|
68
|
+
"./plugin/cjs-interop": {
|
|
69
|
+
"types": "./dist/plugins/cjs-interop.d.ts",
|
|
70
|
+
"default": "./dist/plugins/cjs-interop.js"
|
|
71
|
+
},
|
|
72
|
+
"./plugin/copy": {
|
|
73
|
+
"types": "./dist/plugins/copy.d.ts",
|
|
74
|
+
"default": "./dist/plugins/copy.js"
|
|
75
|
+
},
|
|
76
|
+
"./plugin/data-uri": {
|
|
77
|
+
"types": "./dist/plugins/data-uri.d.ts",
|
|
78
|
+
"default": "./dist/plugins/data-uri.js"
|
|
79
|
+
},
|
|
80
|
+
"./plugin/debarrel": {
|
|
81
|
+
"types": "./dist/plugins/debarrel.d.ts",
|
|
82
|
+
"default": "./dist/plugins/debarrel.js"
|
|
83
|
+
},
|
|
84
|
+
"./plugin/esm-shim-cjs-syntax": {
|
|
85
|
+
"types": "./dist/plugins/esm-shim-cjs-syntax.d.ts",
|
|
86
|
+
"default": "./dist/plugins/esm-shim-cjs-syntax.js"
|
|
87
|
+
},
|
|
88
|
+
"./plugin/fix-dts-default-cjs-exports": {
|
|
89
|
+
"types": "./dist/plugins/fix-dts-default-cjs-exports.d.ts",
|
|
90
|
+
"default": "./dist/plugins/fix-dts-default-cjs-exports.js"
|
|
91
|
+
},
|
|
92
|
+
"./plugin/isolated-declarations": {
|
|
93
|
+
"types": "./dist/plugins/isolated-declarations/index.d.ts",
|
|
94
|
+
"default": "./dist/plugins/isolated-declarations/index.js"
|
|
95
|
+
},
|
|
96
|
+
"./plugin/jsx-remove-attributes": {
|
|
97
|
+
"types": "./dist/plugins/jsx-remove-attributes.d.ts",
|
|
98
|
+
"default": "./dist/plugins/jsx-remove-attributes.js"
|
|
99
|
+
},
|
|
100
|
+
"./plugin/license": {
|
|
101
|
+
"types": "./dist/plugins/license.d.ts",
|
|
102
|
+
"default": "./dist/plugins/license.js"
|
|
103
|
+
},
|
|
104
|
+
"./plugin/native-modules": {
|
|
105
|
+
"types": "./dist/plugins/native-modules-plugin.d.ts",
|
|
106
|
+
"default": "./dist/plugins/native-modules-plugin.js"
|
|
107
|
+
},
|
|
108
|
+
"./plugin/preserve-directives": {
|
|
109
|
+
"types": "./dist/plugins/preserve-directives.d.ts",
|
|
110
|
+
"default": "./dist/plugins/preserve-directives.js"
|
|
111
|
+
},
|
|
112
|
+
"./plugin/raw": {
|
|
113
|
+
"types": "./dist/plugins/raw.d.ts",
|
|
114
|
+
"default": "./dist/plugins/raw.js"
|
|
115
|
+
},
|
|
116
|
+
"./plugin/shebang": {
|
|
117
|
+
"types": "./dist/plugins/shebang.d.ts",
|
|
118
|
+
"default": "./dist/plugins/shebang.js"
|
|
119
|
+
},
|
|
120
|
+
"./plugin/source-maps": {
|
|
121
|
+
"types": "./dist/plugins/source-maps.d.ts",
|
|
122
|
+
"default": "./dist/plugins/source-maps.js"
|
|
123
|
+
},
|
|
124
|
+
"./plugin/url": {
|
|
125
|
+
"types": "./dist/plugins/url.d.ts",
|
|
126
|
+
"default": "./dist/plugins/url.js"
|
|
127
|
+
},
|
|
128
|
+
"./plugin/json": {
|
|
129
|
+
"types": "./dist/plugins/json.d.ts",
|
|
130
|
+
"default": "./dist/plugins/json.js"
|
|
59
131
|
},
|
|
60
132
|
"./package.json": "./package.json"
|
|
61
133
|
},
|
|
@@ -65,35 +137,38 @@
|
|
|
65
137
|
"dist"
|
|
66
138
|
],
|
|
67
139
|
"dependencies": {
|
|
68
|
-
"@babel/parser": "7.28.
|
|
140
|
+
"@babel/parser": "7.28.4",
|
|
69
141
|
"@rollup/plugin-alias": "5.1.1",
|
|
70
|
-
"@rollup/plugin-commonjs": "
|
|
142
|
+
"@rollup/plugin-commonjs": "29.0.0",
|
|
71
143
|
"@rollup/plugin-dynamic-import-vars": "2.1.5",
|
|
72
144
|
"@rollup/plugin-inject": "5.0.5",
|
|
73
145
|
"@rollup/plugin-json": "6.1.0",
|
|
74
146
|
"@rollup/plugin-node-resolve": "16.0.1",
|
|
75
147
|
"@rollup/plugin-replace": "6.0.2",
|
|
76
148
|
"@rollup/plugin-wasm": "6.2.2",
|
|
77
|
-
"@rollup/pluginutils": "5.
|
|
78
|
-
"@visulima/find-cache-dir": "
|
|
79
|
-
"@visulima/fs": "
|
|
80
|
-
"@visulima/package": "
|
|
81
|
-
"@visulima/packem-share": "1.0.0-alpha.
|
|
149
|
+
"@rollup/pluginutils": "5.3.0",
|
|
150
|
+
"@visulima/find-cache-dir": "2.0.4",
|
|
151
|
+
"@visulima/fs": "4.0.4",
|
|
152
|
+
"@visulima/package": "4.1.4",
|
|
153
|
+
"@visulima/packem-share": "1.0.0-alpha.14",
|
|
82
154
|
"@visulima/path": "1.4.0",
|
|
83
|
-
"@visulima/source-map": "
|
|
84
|
-
"
|
|
155
|
+
"@visulima/source-map": "2.0.3",
|
|
156
|
+
"cjs-module-lexer": "^2.1.1",
|
|
157
|
+
"clean-css": "^5.3.3",
|
|
85
158
|
"glob-parent": "6.0.2",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"oxc-
|
|
90
|
-
"
|
|
159
|
+
"html-minifier-next": "^4.3.1",
|
|
160
|
+
"magic-string": "0.30.19",
|
|
161
|
+
"mlly": "1.8.0",
|
|
162
|
+
"oxc-parser": "0.99.0",
|
|
163
|
+
"oxc-resolver": "11.14.0",
|
|
164
|
+
"rollup-plugin-dts": "6.2.3",
|
|
91
165
|
"rollup-plugin-license": "3.6.0",
|
|
92
166
|
"rollup-plugin-polyfill-node": "0.13.0",
|
|
93
167
|
"rollup-plugin-pure": "^0.4.0",
|
|
94
168
|
"rollup-plugin-visualizer": "6.0.3",
|
|
169
|
+
"rs-module-lexer": "^2.6.0",
|
|
95
170
|
"semver": "7.7.2",
|
|
96
|
-
"tinyglobby": "0.2.
|
|
171
|
+
"tinyglobby": "0.2.15"
|
|
97
172
|
},
|
|
98
173
|
"peerDependencies": {
|
|
99
174
|
"@swc/core": "*",
|
|
@@ -124,7 +199,7 @@
|
|
|
124
199
|
}
|
|
125
200
|
},
|
|
126
201
|
"engines": {
|
|
127
|
-
"node": ">=
|
|
202
|
+
"node": ">=20.19.* <=25.*"
|
|
128
203
|
},
|
|
129
204
|
"publishConfig": {
|
|
130
205
|
"access": "public",
|
package/dist/index.d.mts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Plugin, RenderedChunk, GetManualChunk, CustomPluginOptions } from 'rollup';
|
|
2
|
-
import { P as PailServerType } from './packem_shared/types-C_grznAP.mjs';
|
|
3
|
-
export { C as CJSInteropOptions, a as CopyPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, k as IsolatedDeclarationsResult, n as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, o as PackemRollupOptions, R as RawLoaderOptions, p as RollupPlugins, S as ShebangOptions, f as SourcemapsPluginOptions, T as TransformerFn, q as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, e as esmShimCjsSyntaxPlugin, g as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, r as rawPlugin, d as removeShebangPlugin, s as shebangPlugin, h as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-C_grznAP.mjs';
|
|
4
|
-
export { b as browserslistToEsbuild } from './packem_shared/browserslist-to-esbuild-DY9HwYtp.mjs';
|
|
5
|
-
import { RollupJsonOptions } from '@rollup/plugin-json';
|
|
6
|
-
import { FileCache } from '@visulima/packem-share/utils';
|
|
7
|
-
import { FilterPattern } from '@rollup/pluginutils';
|
|
8
|
-
import { BuildContextBuildAssetAndChunk, BuildContextBuildEntry } from '@visulima/packem-share/types';
|
|
9
|
-
export { Alias, ResolverObject as AliasResolverObject, ResolvedAlias, RollupAliasOptions, default as alias } from '@rollup/plugin-alias';
|
|
10
|
-
export { RollupCommonJSOptions, default as commonjs } from '@rollup/plugin-commonjs';
|
|
11
|
-
export { RollupDynamicImportVariablesOptions, default as dynamicImportVars } from '@rollup/plugin-dynamic-import-vars';
|
|
12
|
-
export { RollupInjectOptions, default as inject } from '@rollup/plugin-inject';
|
|
13
|
-
export { RollupNodeResolveOptions, default as nodeResolve } from '@rollup/plugin-node-resolve';
|
|
14
|
-
export { RollupReplaceOptions, default as replace } from '@rollup/plugin-replace';
|
|
15
|
-
export { RollupWasmOptions, default as wasm } from '@rollup/plugin-wasm';
|
|
16
|
-
export { NodePolyfillsOptions as RollupNodePolyfillsOptions, default as polyfillNode } from 'rollup-plugin-polyfill-node';
|
|
17
|
-
export { PureAnnotationsOptions as RollupPureAnnotationsOptions, PluginPure as pure } from 'rollup-plugin-pure';
|
|
18
|
-
export { PluginVisualizerOptions as RollupPluginVisualizerOptions, default as visualizer } from 'rollup-plugin-visualizer';
|
|
19
|
-
import 'rollup-plugin-dts';
|
|
20
|
-
import 'esbuild';
|
|
21
|
-
import '@visulima/package';
|
|
22
|
-
import 'oxc-resolver';
|
|
23
|
-
import 'oxc-transform';
|
|
24
|
-
import 'sucrase';
|
|
25
|
-
|
|
26
|
-
declare const chunkSplitter: () => Plugin;
|
|
27
|
-
|
|
28
|
-
type FixDtsDefaultCjsExportsPluginOptions = {
|
|
29
|
-
matcher?: (info: RenderedChunk) => boolean;
|
|
30
|
-
};
|
|
31
|
-
declare const fixDtsDefaultCjsExportsPlugin: (options?: FixDtsDefaultCjsExportsPluginOptions) => Plugin;
|
|
32
|
-
|
|
33
|
-
declare const fixDynamicImportExtension: () => Plugin;
|
|
34
|
-
|
|
35
|
-
declare const JSONPlugin: (options: RollupJsonOptions) => Plugin;
|
|
36
|
-
|
|
37
|
-
declare const metafilePlugin: () => Plugin;
|
|
38
|
-
|
|
39
|
-
declare const cachingPlugin: (plugin: Plugin, cache: FileCache, subDirectory?: string) => Plugin;
|
|
40
|
-
|
|
41
|
-
declare const preserveDirectives: ({ directiveRegex, exclude, include, logger, }: {
|
|
42
|
-
directiveRegex: RegExp;
|
|
43
|
-
exclude?: FilterPattern;
|
|
44
|
-
include?: FilterPattern;
|
|
45
|
-
logger: PailServerType;
|
|
46
|
-
}) => Plugin;
|
|
47
|
-
|
|
48
|
-
declare const resolveFileUrl: () => Plugin;
|
|
49
|
-
|
|
50
|
-
declare const createSplitChunks: (dependencyGraphMap: Map<string, Set<[string, string]>>, entryFiles: (BuildContextBuildAssetAndChunk | BuildContextBuildEntry)[]) => GetManualChunk;
|
|
51
|
-
|
|
52
|
-
declare const getCustomModuleLayer: (moduleId: string) => string | undefined;
|
|
53
|
-
|
|
54
|
-
declare const getModuleLayer: (moduleMeta: CustomPluginOptions) => any;
|
|
55
|
-
|
|
56
|
-
export { cachingPlugin, chunkSplitter, createSplitChunks, fixDtsDefaultCjsExportsPlugin, fixDynamicImportExtension, getCustomModuleLayer, getModuleLayer, JSONPlugin as jsonPlugin, metafilePlugin, preserveDirectives as preserveDirectivesPlugin, resolveFileUrl };
|
package/dist/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{default as o}from"./packem_shared/chunkSplitter-DWAy1JkE.mjs";import{cjsInteropPlugin as a}from"./packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs";import{copyPlugin as f}from"./packem_shared/copyPlugin--6RITp1-.mjs";import{default as u}from"./packem_shared/browserslistToEsbuild-C0IWmbNe.mjs";import{esmShimCjsSyntaxPlugin as p}from"./packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs";import{fixDtsDefaultCjsExportsPlugin as x}from"./packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs";import{default as d}from"./packem_shared/fixDynamicImportExtension-BBGNRniz.mjs";import{isolatedDeclarationsPlugin as c}from"./packem_shared/isolatedDeclarationsPlugin-A0wmmw3Y.mjs";import{default as b}from"./packem_shared/jsonPlugin-BAi3Da-h.mjs";import{jsxRemoveAttributes as j}from"./packem_shared/jsxRemoveAttributes-B1PLPffj.mjs";import{license as y}from"./packem_shared/licensePlugin-C5yzUqe-.mjs";import{default as D}from"./packem_shared/metafilePlugin-ObS4J7mO.mjs";import{default as E}from"./packem_shared/cachingPlugin-D0BBFJPD.mjs";import{default as w}from"./packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs";import{rawPlugin as L}from"./packem_shared/rawPlugin-BqlR6ZOI.mjs";import{default as R}from"./packem_shared/resolveFileUrl-BkpjVHeK.mjs";import{getShebang as A,makeExecutable as F,removeShebangPlugin as N,shebangPlugin as T}from"./packem_shared/makeExecutable-6aOVHoJR.mjs";import{sourcemapsPlugin as V}from"./packem_shared/sourcemapsPlugin-B4W3J79w.mjs";import{urlPlugin as B}from"./packem_shared/urlPlugin-DBgFIkTc.mjs";import{default as H}from"./packem_shared/createSplitChunks-CGDk55G3.mjs";import{default as K}from"./packem_shared/getCustomModuleLayer-d8i66lfh.mjs";import{default as Q}from"./packem_shared/getModuleLayer-rF9RxnJ5.mjs";import{default as X}from"@rollup/plugin-alias";import{default as Z}from"@rollup/plugin-commonjs";import{default as $}from"@rollup/plugin-dynamic-import-vars";import{default as re}from"@rollup/plugin-inject";import{default as te}from"@rollup/plugin-node-resolve";import{default as le}from"@rollup/plugin-replace";import{default as se}from"@rollup/plugin-wasm";import{default as me}from"rollup-plugin-polyfill-node";import{PluginPure as ie}from"rollup-plugin-pure";import{default as ne}from"rollup-plugin-visualizer";export{X as alias,u as browserslistToEsbuild,E as cachingPlugin,o as chunkSplitter,a as cjsInteropPlugin,Z as commonjs,f as copyPlugin,H as createSplitChunks,$ as dynamicImportVars,p as esmShimCjsSyntaxPlugin,x as fixDtsDefaultCjsExportsPlugin,d as fixDynamicImportExtension,K as getCustomModuleLayer,Q as getModuleLayer,A as getShebang,re as inject,c as isolatedDeclarationsPlugin,b as jsonPlugin,j as jsxRemoveAttributes,y as licensePlugin,F as makeExecutable,D as metafilePlugin,te as nodeResolve,me as polyfillNode,w as preserveDirectivesPlugin,ie as pure,L as rawPlugin,N as removeShebangPlugin,le as replace,R as resolveFileUrl,T as shebangPlugin,V as sourcemapsPlugin,B as urlPlugin,ne as visualizer,se as wasm};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var h=Object.defineProperty;var m=(a,r)=>h(a,"name",{value:r,configurable:!0});import{join as l}from"@visulima/path";import{getHash as o}from"@visulima/packem-share/utils";var g=Object.defineProperty,f=m((a,r)=>g(a,"name",{value:r,configurable:!0}),"m");const c=f(a=>a.handler||a,"getHandler"),v=f((a,r,d="")=>({...a,async buildEnd(n){a.buildEnd&&await c(a.buildEnd).call(this,n)},async buildStart(n){a.buildStart&&await c(a.buildStart).call(this,n)},async load(n){if(!a.load)return;const t=l(d,a.name),s=l("load",o(n));if(r.has(s,t))return await r.get(s,t);const e=await c(a.load).call(this,n);return r.set(s,e,t),e},name:`cached(${a.name})`,async resolveId(n,t,s){if(!a.resolveId)return;const e=l(d,a.name),i=l("resolveId",o(n),t?o(t):"",o(JSON.stringify(s)));if(r.has(i,e))return await r.get(i,e);const u=await c(a.resolveId).call(this,n,t,s);return r.set(i,u,e),u},async transform(n,t){if(!a.transform)return;const s=l(d,a.name),e=l("transform",o(t),o(n));if(r.has(e,s))return await r.get(e,s);const i=await c(a.transform).call(this,n,t);return r.set(e,i,s),i}}),"cachingPlugin");export{v as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var g=Object.defineProperty;var l=(c,i)=>g(c,"name",{value:i,configurable:!0});import{stat as x}from"node:fs/promises";import{readFile as h}from"@visulima/fs";import{arrayify as u}from"@visulima/packem-share/utils";import{normalize as b,join as y,relative as w,dirname as F,basename as P}from"@visulima/path";import $ from"glob-parent";import{glob as v}from"tinyglobby";var A=Object.defineProperty,j=l((c,i)=>A(c,"name",{value:i,configurable:!0}),"f");const C=j((c,i)=>{const n=new Map,p={copyOnce:!0,exactFileNames:!0,flatten:!1,...c};let{targets:o}=p;return Array.isArray(o)?o=o.map(s=>{if(typeof s=="string")return{src:s};if(typeof s=="object"&&"src"in s)return s}).filter(Boolean):typeof o=="string"&&(o=[{src:o}]),{async buildStart(){const s=await Promise.all(o.flatMap(e=>Array.isArray(e.src)?e.src.map(r=>({...e,src:r})):e).map(async e=>await v(u(e.src),{ignore:u(e.exclude).filter(Boolean)}).then(r=>({dest:e.dest??"",parent:$(e.src),src:r}))));for(const e of s)for(const r of e.src){let a;n.has(r)?a=n.get(r):(a={copied:[],dest:[],timestamp:0},n.set(r,a));const t=p.flatten?b(e.dest):y(e.dest,w(e.parent,F(r)));a.dest.includes(t)||a.dest.push(t),this.addWatchFile(r)}i.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...n].map(async([e,r])=>{let a;try{const t=await x(e);if(!t.isFile())return;const m=t.mtime.getTime();m>r.timestamp&&(r.timestamp=m,r.copied=[]),a=await h(e,{buffer:!0})}catch(t){i.error({context:[t],message:`error reading file ${e}`,prefix:"plugin:copy"});return}for(const t of r.dest){if(p.copyOnce&&r.copied.includes(t))continue;const m=P(e),f=y(t,m);try{this.emitFile({[p.exactFileNames?"fileName":"name"]:f,source:a,type:"asset"}),i.debug({message:`copied ${e} → ${f}`,prefix:"plugin:copy"}),r.copied.push(t)}catch(d){i.error({context:[d],message:`error copying file ${e} → ${f}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");export{C as copyPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var I=Object.defineProperty;var p=(t,n)=>I(t,"name",{value:n,configurable:!0});import{memoize as y}from"@visulima/packem-share/utils";import{basename as b,extname as w}from"@visulima/path";import S from"./getCustomModuleLayer-d8i66lfh.mjs";import l from"./getModuleLayer-rF9RxnJ5.mjs";var $=Object.defineProperty,h=p((t,n)=>$(t,"name",{value:n,configurable:!0}),"d");const M=y(t=>{let n=0;for(let r=0;r<t.length;r+=1)n=(n<<5)-n+t.codePointAt(r);return(n>>>0).toString(36).slice(0,3)}),j=h((t,n)=>{const r=new Map;return h(function(e,u){if(/[\\/]node_modules[\\/]@swc[\\/]helper/.test(e))return"cc";const c=u.getModuleInfo(e);if(!c)return;const{isEntry:m}=c,d=c.meta;let s=l(d);if(s&&(s=M(s)),!m){const f=r.get(e);if(f)return f;const o=S(e);if(o)return r.set(e,o),o}if(m){const f=u.getModuleIds();for(const o of f)u.getModuleInfo(o)&&l(d)===s&&(t.has(o)||t.set(o,new Set),t.get(o).add([e,s]))}if(s&&!m&&t.has(e)){const f=[...t.get(e)];if(f.some(([i])=>{if(n.some(a=>a.path===i)){const a=u.getModuleInfo(i);return l(a?a.meta:{})===s}return!1}))return;if(f.every(([,i])=>i===s))return r.has(e)?r.get(e):void 0;const o=b(e,w(e)),v=M(s),g=`${o}-${v}`;return r.set(e,g),g}},"splitChunks")},"createSplitChunks");export{j as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var j=Object.defineProperty;var u=(e,r)=>j(e,"name",{value:r,configurable:!0});import{createFilter as x}from"@rollup/pluginutils";import{DEFAULT_LOADERS as k}from"@visulima/packem-share/constants";import{join as O,extname as $}from"@visulima/path";import{formatMessages as E,transform as b,build as M}from"esbuild";import{findCacheDirSync as A}from"@visulima/find-cache-dir";import{readFileSync as P}from"@visulima/fs";import{init as R,parse as S}from"es-module-lexer";var F=Object.defineProperty,C=u((e,r)=>F(e,"name",{value:r,configurable:!0}),"n$1");const h=C(async(e,r)=>{r.length>0&&(await E(r,{color:!0,kind:"warning"})).forEach(s=>e.warn(s))},"warn");var L=Object.defineProperty,w=u((e,r)=>L(e,"name",{value:r,configurable:!0}),"t");const W=w(e=>{if(e==="es")return"esm";if(e==="cjs")return e},"getEsbuildFormat"),I=w(({sourceMap:e=!0,...r})=>async function(s,n,t){if(r.minify||r.minifyWhitespace||r.minifyIdentifiers||r.minifySyntax){const i=W(t.format),c=await b(s,{format:i,loader:"js",sourcemap:e,...r});if(await h(this,c.warnings),c.code)return{code:c.code,map:c.map||void 0}}},"getRenderChunk");var T=Object.defineProperty,y=u((e,r)=>T(e,"name",{value:r,configurable:!0}),"n");const v=y(e=>e.replaceAll("\\","/"),"slash"),q=y(async e=>{const r=A("@visulima/packem/optimize-deps",{create:!0,cwd:e.cwd});if(!r)throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');await R,await M({absWorkingDir:e.cwd,bundle:!0,entryPoints:e.include,format:"esm",ignoreAnnotations:!0,metafile:!0,outdir:r,sourcemap:e.sourceMap,splitting:!0,...e.esbuildOptions,plugins:[{name:"optimize-deps",async setup(n){n.onResolve({filter:/.*/},async t=>{if(e.exclude?.includes(t.path))return{external:!0};if(!t.pluginData?.__resolving_dep_path__&&e.include.includes(t.path)){const i=await n.resolve(t.path,{kind:"import-statement",pluginData:{__resolving_dep_path__:!0},resolveDir:t.resolveDir});return i.errors.length>0||i.warnings.length>0?i:{namespace:"optimize-deps",path:t.path,pluginData:{absolute:i.path,resolveDir:t.resolveDir}}}}),n.onLoad({filter:/.*/,namespace:"optimize-deps"},async t=>{const{absolute:i,resolveDir:c}=t.pluginData,[,p]=S(P(i));return{contents:p.length>0?`export * from '${v(i)}'`:`module.exports = require('${v(i)}')`,resolveDir:c}})}},...e.esbuildOptions?.plugins??[]]});const s=new Map;for(const n of e.include)s.set(n,{file:O(r,`${n}.js`)});return{cacheDir:r,optimized:s}},"optimizeDeps");var N=Object.defineProperty,U=u((e,r)=>N(e,"name",{value:r,configurable:!0}),"g");const B=U(({exclude:e,include:r,loaders:s,logger:n,optimizeDeps:t,sourceMap:i,...c})=>{const p=k;if(s!==void 0)for(let[a,o]of Object.entries(s)){const d=a.startsWith(".")?a:`.${a}`;typeof o=="string"?p[d]=o:o||delete p[d]}const D=Object.keys(p),_=new RegExp(`\\.(${D.map(a=>a.slice(1)).join("|")})$`),z=x(r??_,e);let l,g=process.cwd();return{async buildStart(){!t||l||(l=await q({cwd:g,sourceMap:i??!1,...t}),n.debug("optimized %O",l.optimized))},name:"packem:esbuild",options({context:a}){a&&(g=a)},renderChunk:I({...c,sourceMap:i}),async resolveId(a){if(l?.optimized.has(a)){const o=l.optimized.get(a);if(o)return n.debug("resolved %s to %s",a,o.file),o.file}},async transform(a,o){if(!z(o)||l?.optimized.has(o))return;const d=$(o),m=p[d];if(n.debug("transforming %s with %s loader",o,m),!m)return;const f=await b(a,{format:["base64","binary","dataurl","text","json"].includes(m)?"esm":void 0,loader:m,sourcefile:o.replace(/\.[cm]ts/,".ts"),sourcemap:i,...c});if(await h(this,f.warnings),f.code)return{code:f.code,map:f.map||void 0}}}},"esbuildTransformer");B.NAME="esbuild";export{B as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var n=(e,r)=>i(e,"name",{value:r,configurable:!0});import{_ as o}from"./fix-dts-default-cjs-exports-BQc0nwIG.mjs";var p=Object.defineProperty,a=n((e,r)=>p(e,"name",{value:r,configurable:!0}),"n");const l=a((e={})=>{const{matcher:r=a(t=>(t.type==="chunk"||t.type==="asset")&&t.exports?.length>0&&/\.d\.c?ts$/.test(t.fileName)&&t.isEntry,"matcher")}=e;return{name:"packem:fix-dts-default-cjs-exports-plugin",renderChunk(t,s){return r(s)?o(t,{fileName:s.fileName,imports:s.imports},{warn:this.warn}):void 0}}},"fixDtsDefaultCjsExportsPlugin");export{l as fixDtsDefaultCjsExportsPlugin};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var M=Object.defineProperty;var $=(t,e)=>M(t,"name",{value:e,configurable:!0});import{createFilter as T}from"@rollup/pluginutils";import{readFile as G}from"@visulima/fs";import{ENDING_REGEX as O}from"@visulima/packem-share/constants";import{getDtsExtension as U}from"@visulima/packem-share/utils";import{dirname as I,toNamespacedPath as w,sep as D,extname as _,join as W,basename as F,relative as C}from"@visulima/path";import{parseAsync as J}from"oxc-parser";import{_ as L}from"./fix-dts-default-cjs-exports-BQc0nwIG.mjs";var X=Object.defineProperty,q=$((t,e)=>X(t,"name",{value:e,configurable:!0}),"e");const A=/^([\w-]+):/,P=q(t=>{if(!t||typeof t!="string")throw new Error("Invalid key: Key must be a non-empty string.");const e=[],c=A.exec(t);c&&(e.push(c[1]),t=t.replace(A,""));const a=t.split("/");for(const l of a)(l.includes("*")||l)&&e.push(l);return e},"splitTsconfigPathKey");var z=Object.defineProperty,B=$((t,e)=>z(t,"name",{value:e,configurable:!0}),"h");const H=B((t,e)=>{const c=t.replace(/^\.\//,""),a=e.replace(/^\.\//,"");if(a.startsWith(c))return t+a.slice(c.length);if(t.endsWith(e))return t;const l=P(t),d=P(e);let p=l.length-1,r=d.length-1;for(;p>=0&&r>=0&&l[p]===d[r];)p--,r--;let n=l.slice(0,p).join("/");const m=d.slice(r).join("/");return(!n.startsWith(".")||n==="")&&(n=`./${n}`),n+(m?`/${m}`:"")},"extendString");var Q=Object.defineProperty,V=$((t,e)=>Q(t,"name",{value:e,configurable:!0}),"s");const Y=V((...t)=>{if(t.length===0)return"";if(t.length===1)return I(t[0]);t=t.map(l=>w(l).split(D).join("/"));const[e,...c]=t;let a=e.split("/");for(const l of c){const d=l.split("/",a.length);let p=0;for(const r of d)if(r===a[p])p+=1;else{a=a.slice(0,p);break}a=a.slice(0,p)}return(a.length<=1&&a[0]===""?`/${a[0]}`:a.join("/")).split("/").join(D)},"lowestCommonAncestor");var Z=Object.defineProperty,x=$((t,e)=>Z(t,"name",{value:e,configurable:!0}),"u");const K=x((t,e)=>`${t}
|
|
2
|
-
//# sourceMappingURL=${F(e)}.map
|
|
3
|
-
`,"appendMapUrl"),k=x((t,e,c)=>JSON.stringify({file:F(c),mappings:t,names:[],sourceRoot:"",sources:[C(I(c),e)],version:3}),"generateDtsMap"),ce=x((t,e)=>{const c=T(e.options.include,e.options.exclude);let a=Object.create(null);const l=x((r,n)=>{a[r.replace(O,"")]={...n,ext:_(r)}},"addOutput");let d=[];e.tsconfig?.config.compilerOptions&&(d=Object.entries(e.tsconfig.config.compilerOptions.paths??{}).map(([r])=>r.endsWith("*")?new RegExp(`^${r.replace("*","(.*)")}$`):new RegExp(`^${r}$`)));async function p(r,n){if(!c(n))return;let m;try{m=(await J(n,r)).program}catch(o){e.logger.debug({message:o.message,prefix:"packem:isolated-declarations"})}if(m){const o=m.body.filter(s=>(s.type==="ImportDeclaration"||s.type==="ExportAllDeclaration"||s.type==="ExportNamedDeclaration")&&!!s.source);for await(const s of o){if(F(s.source.value).includes("."))continue;const i=await this.resolve(s.source.value,n);if(!(!i||i.external)&&(i.id.endsWith(".ts")||i.id.endsWith(".cts")||i.id.endsWith(".mts")||i.id.endsWith(".tsx")||i.id.endsWith(".ctsx")||i.id.endsWith(".mtsx"))){const g=i.id.replace(`${t}/`,"");let j=s.source.value;d.some(f=>f.test(s.source.value))&&!s.source.value.startsWith(".")&&(j=`./${s.source.value}`),r=r.replaceAll(`from "${s.source.value}"`,`from "${H(j,g)}"`)}}}const{errors:y,map:u,sourceText:v}=await e.options.isolatedDeclarationTransformer(n,r,e.options.sourcemap,e.tsconfig?.config?.compilerOptions);if(y.length>0){if(e.options.rollup.isolatedDeclarations.ignoreErrors){this.warn(y[0]);return}return this.error(y[0])}if(l(n,{map:u,source:v}),!m)return;const h=m.body.filter(o=>!("source"in o)||!o.source?!1:"importKind"in o&&o.importKind==="type"||"exportKind"in o&&o.exportKind==="type"?!0:o.type==="ImportDeclaration"?!!o.specifiers&&o.specifiers.every(s=>s.type==="ImportSpecifier"&&s.importKind==="type"):o.type==="ExportNamedDeclaration"&&o.specifiers&&o.specifiers.every(s=>s.exportKind==="type"));for await(const o of h){if(!o.source)continue;const s=await this.resolve(o.source.value,n);if(!s)return;const i=s.id;if(c(i)&&!a[i.replace(O,"")])try{const g=await G(i);await p.call(this,g,i)}catch{}}}return $(p,"E"),x(p,"transform"),{buildStart(){a=Object.create(null)},name:"packem:isolated-declarations",async renderStart(r,{input:n}){const m=Y(...Array.isArray(n)?n:Object.values(n));e.logger.debug({message:`Input base:${m}`,prefix:"packem:isolated-declarations"}),typeof r.entryFileNames=="function"&&(r.entryFileNames=r.entryFileNames({name:r.name}));const y=r.entryFileNames.replace(/\.(.)?[jt]sx?$/,(u,v)=>`.d.${v||""}ts`);for await(let[u,{ext:v,map:h,source:o}]of Object.entries(a)){if(e.options.rollup.cjsInterop&&r.format==="cjs"){const f=L(o,{fileName:u,imports:[]},{warn:this.warn});f&&(o=f.code)}const s=o.includes("from '")?"'":'"',i=u+v;if((e.options.declaration===!0||e.options.declaration==="compatible")&&r.format==="cjs"){e.logger.debug({message:`Emit compatible dts file: ${u}`,prefix:"packem:isolated-declarations"});const f=y.replace("[name]",w(u).replace(`${t}/`,"")).replace(".cts",".ts");let b=o;e.options.sourcemap&&h&&(b=K(b.trim(),f),this.emitFile({fileName:`${f}.map`,originalFileName:i,source:k(h,i,W(r.dir,f)),type:"asset"})),this.emitFile({fileName:f,originalFileName:i,source:b.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(E,N,R,S)=>`${N+s+(S||R)}.d.ts${s};`),type:"asset"})}e.logger.debug({message:`Emit dts file: ${u}`,prefix:"packem:isolated-declarations"});const g=y.replace("[name]",w(u).replace(`${t}/`,""));e.options.sourcemap&&h&&(o=K(o.trim(),g),this.emitFile({fileName:`${g}.map`,originalFileName:i,source:k(h,i,W(r.dir,g)),type:"asset"}));const j=U(e,r.format==="cjs"?"cjs":"esm");this.emitFile({fileName:g,originalFileName:i,source:o.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(f,b,E,N)=>`${b+s+(N||E)}.${j}${s};`),type:"asset"})}},transform:p}},"isolatedDeclarationsPlugin");export{ce as isolatedDeclarationsPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var c=Object.defineProperty;var o=(t,r)=>c(t,"name",{value:r,configurable:!0});import u from"@rollup/plugin-json";var i=Object.defineProperty,l=o((t,r)=>i(t,"name",{value:r,configurable:!0}),"n");const n="export default ",m=l(t=>{const r=u(t);return{...r,name:"packem:json",transform(a,s){const e=r.transform?.call(this,a,s);return e&&typeof e!="string"&&"code"in e&&e.code?.startsWith(n)&&(e.code=e.code.replace(n,"module.exports = ")),e}}},"JSONPlugin");export{m as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var l=(e,a)=>f(e,"name",{value:a,configurable:!0});import{createFilter as y}from"@rollup/pluginutils";import{w as b}from"./index-Dq8IUFTs.mjs";import v from"magic-string";var d=Object.defineProperty,x=l((e,a)=>d(e,"name",{value:a,configurable:!0}),"u");const A=x(({attributes:e,logger:a})=>{const m=y([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(i,n){if(!m(n))return;let u;try{u=this.parse(i,{allowReturnOutsideFunction:!0})}catch(r){this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${n}" and remove the jsx attribute.`}),a.warn(r);return}let p=!1;const o=new v(i);if(b(u,{enter(r){if(r.type==="CallExpression"&&r.callee.type==="Identifier"&&r.callee.name==="jsx"){const c=r.arguments.filter(s=>s.type==="ObjectExpression"&&Array.isArray(s.properties));for(const s of c)for(const t of s.properties)t.type==="Property"&&t.key.type==="Literal"&&t.value.type==="Literal"&&e.includes(t.key.value)&&(o.overwrite(t.start-2,t.end,""),p=!0)}}}),!!p)return{code:o.toString(),map:o.generateMap({hires:!0})}}}},"jsxRemoveAttributes");export{A as jsxRemoveAttributes};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var S=Object.defineProperty;var h=(r,e)=>S(r,"name",{value:e,configurable:!0});import{readFileSync as b,writeFileSync as v}from"@visulima/fs";import{replaceContentWithinMarker as F}from"@visulima/packem-share/utils";import P from"rollup-plugin-license";var T=Object.defineProperty,y=h((r,e)=>T(r,"name",{value:e,configurable:!0}),"d");const C=y(r=>{const e=[],l=[];return r.forEach(t=>{t.startsWith("(")?e.push(t):l.push(t)}),[...l.sort(),...e.sort()]},"sortLicenses"),z=y(({dtsMarker:r,licenseFilePath:e,licenseTemplate:l,logger:t,marker:s,mode:m,packageName:x})=>P({thirdParty(A){const u=new Set,d=A.sort(({name:n},{name:i})=>(n||0)>(i||0)?1:(i||0)>(n||0)?-1:0).map(({author:n,contributors:i,license:c,licenseText:$,maintainers:k,name:w,repository:p})=>{let a=`## ${w}
|
|
2
|
-
`;c&&(a+=`License: ${c}
|
|
3
|
-
`);const f=new Set;for(const o of[n,...k,...i]){const g=typeof o=="string"?o:o?.name;g&&f.add(g)}return f.size>0&&(a+=`By: ${[...f].join(", ")}
|
|
4
|
-
`),p&&(a+=`Repository: ${typeof p=="string"?p:p.url}
|
|
5
|
-
`),$&&(a+=`
|
|
6
|
-
${$.trim().replaceAll(/\r\n|\r/g,`
|
|
7
|
-
`).replaceAll(`<!-- ${s} -->`,"").replaceAll(r?`<!-- ${r} -->`:"","").replaceAll(`<!-- /${s} -->`,"").replaceAll(r?`<!-- /${r} -->`:"","").trim().split(`
|
|
8
|
-
`).map(o=>o?`> ${o}`:">").join(`
|
|
9
|
-
`)}
|
|
10
|
-
`),c&&u.add(c),a}).join(`
|
|
11
|
-
---------------------------------------
|
|
12
|
-
|
|
13
|
-
`);if(d===""){t.info({message:"No dependencies license information found.",prefix:`plugin:license:${m}`});return}const j=l(C(u),d,x);try{const n=b(e),i=F(n,s,j);if(!i){t.error({message:`Could not find the license marker: <!-- ${s} --><!-- /${s} --> in ${e}`,prefix:`plugin:license:${m}`});return}n!==i&&(v(e,i),t.info({message:`${e} updated.`,prefix:`plugin:license:${m}`}))}catch(n){t.error(n)}}}),"license");export{z as license};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var S=Object.defineProperty;var g=(o,e)=>S(o,"name",{value:e,configurable:!0});import{createFilter as P}from"@rollup/pluginutils";import{findPackageJson as k}from"@visulima/package/package-json";import{dirname as n}from"@visulima/path";import{ResolverFactory as J}from"oxc-resolver";var M=Object.defineProperty,m=g((o,e)=>M(o,"name",{value:e,configurable:!0}),"a");let b;const A=new Map,z=m((o,e,h,u)=>{const{ignoreSideEffectsForRoot:E,...a}=o;let c=b;return c||(c=b=new J({...a,roots:[...a.roots??[],e],tsconfig:u?{configFile:u,references:"auto"}:void 0})),{name:"oxc-resolve",resolveId:{async handler(v,l,{isEntry:w}){const p=w||!l?n(v):n(l),{error:x,path:r}=await c.async(p,v);if(x){h.debug(x,{context:[{basedir:e,extensions:a.extensions,id:r}]});return}let f=m(s=>!1,"hasModuleSideEffects");try{const{packageJson:s,path:F}=await k(n(r),{cache:A}),y=n(F);if(!E||e!==y){const i=s.sideEffects;if(typeof i=="boolean")f=m(()=>i,"hasModuleSideEffects");else if(Array.isArray(i)){const R=i.map(d=>d.includes("/")?d:`**/${d}`);f=P(R,void 0,{resolve:y})}}}catch(s){console.debug(s.message,{context:[{basedir:p,caller:"Resolver",error:s,extensions:a.extensions,id:r}]})}const t=await this.resolve(r,l,{skipSelf:!0});if(t)return t.external?!1:t.id!==r?t:{id:r,meta:t.meta,moduleSideEffects:f(r)}},order:"post"}}},"oxcResolvePlugin");export{z as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=Object.defineProperty;var t=(e,r)=>n(e,"name",{value:r,configurable:!0});import{createFilter as c}from"@rollup/pluginutils";var l=Object.defineProperty,u=t((e,r)=>l(e,"name",{value:r,configurable:!0}),"i");const s=u(e=>{const r=c(e.include,e.exclude);return{async load(a){if(a.includes("?raw"))return await this.load({id:a.replace(/\?raw$/,"")})},name:"packem:raw",transform(a,i){if(!(!r(i)&&!i.includes("?raw")))return i.includes("?raw")||(a=`export default ${JSON.stringify(a)}`),{code:a,map:{mappings:""}}}}},"rawPlugin");export{s as rawPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var b=Object.defineProperty;var d=(t,e)=>b(t,"name",{value:e,configurable:!0});import{isAbsolute as k,join as P,dirname as O,resolve as $}from"@visulima/path";import{isRelative as y}from"@visulima/path/utils";var j=Object.defineProperty,o=d((t,e)=>j(t,"name",{value:e,configurable:!0}),"o");const S=42,U=o(t=>{let e=!1;for(let s=0;s<t.length;s++)if(t.codePointAt(s)===S){if(e)return!1;e=!0}return!0},"hasZeroOrOneAsteriskCharacter"),W=o(t=>{const e=t.indexOf("*");return e===-1?void 0:{prefix:t.slice(0,e),suffix:t.slice(e+1)}},"tryParsePattern"),A=o(({prefix:t,suffix:e},s)=>s.length>=t.length+e.length&&s.startsWith(t)&&s.endsWith(e),"isPatternMatch"),T=o((t,e,s)=>{let i,r=-1;for(const f of t){const a=e(f);A(a,s)&&a.prefix.length>r&&(r=a.prefix.length,i=f)}return i},"findBestPatternMatch"),B=o((t,e)=>{const s=[];for(const i of t){if(!U(i))continue;const r=W(i);if(r)s.push(r);else if(i===e)return i}return T(s,i=>i,e)},"matchPatternOrExact"),q=o((t,e)=>e.substring(t.prefix.length,e.length-t.suffix.length),"matchedText"),R=o(({prefix:t,suffix:e})=>`${t}*${e}`,"patternText"),w=o((t,e,s)=>{let i=O(e.path);e.config.compilerOptions?.baseUrl&&(i=$(t,e.config.compilerOptions.baseUrl)),s?.debug({message:`Resolved baseUrl to ${i}`,prefix:"plugin:packem:resolve-tsconfig-paths"});const r=e.config.compilerOptions?.paths??{};return Object.keys(r).length===0&&s?.debug({message:"No paths found in tsconfig.json",prefix:"plugin:packem:resolve-tsconfig-paths"}),{paths:r,resolvedBaseUrl:i}},"getTsconfigPaths"),C=o((t,e,s,i)=>{const{paths:r,resolvedBaseUrl:f}=w(t,e,s),a=Object.keys(r);return{name:"packem:resolve-tsconfig-paths",async resolveId(n,m,v){if(a.length===0)return;if(n.includes("\0")){s.debug({message:`Skipping resolution of ${n} as it is a virtual module`,prefix:"plugin:packem:resolve-tsconfig-paths"});return}if(n.includes("node_modules")){s.debug({message:`Skipping request as it is inside node_modules ${n}`,prefix:"plugin:packem:resolve-tsconfig-paths"});return}if(!i.resolveAbsolutePath&&k(n)){s.debug({message:`Skipping request as it is an absolute path ${n}`,prefix:"plugin:packem:resolve-tsconfig-paths"});return}if(y(n)){s.debug({message:`Skipping request as it is a relative path ${n}`,prefix:"plugin:packem:resolve-tsconfig-paths"});return}const l=B(a,n);if(!l){s.debug({message:`moduleName did not match any paths pattern ${n}`,prefix:"plugin:packem:resolve-tsconfig-paths"});return}const u=typeof l=="string"?void 0:q(l,n),x=typeof l=="string"?l:R(l);for await(const g of r[x]){const p=u?g.replace("*",u):g;if(p.endsWith(".d.ts")||p.endsWith(".d.cts")||p.endsWith(".d.mts"))continue;const h=P(f,p);try{const c=await this.resolve(h,m,{skipSelf:!0,...v});if(c)return c}catch(c){s.debug({context:[c],message:`Failed to resolve ${h} from ${n}`,prefix:"plugin:packem:resolve-tsconfig-paths"})}}}}},"resolveTsconfigPathsPlugin");export{C as resolveTsconfigPathsPlugin};
|