@visulima/packem-rollup 1.0.0-alpha.23 → 1.0.0-alpha.25
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 +20 -0
- package/LICENSE.md +0 -436
- package/dist/index.d.ts +25 -26
- 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-BrFhdKJk.mjs → esbuildPlugin-DpLtQGuZ.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-pUcTdE77.mjs → resolveTsconfigPathsPlugin-CEasmDpi.js} +1 -1
- package/dist/packem_shared/{resolveTsconfigRootDirectoriesPlugin-_93afm2q.mjs → resolveTsconfigRootDirectoriesPlugin-Cwj3tqCJ.js} +1 -1
- package/dist/packem_shared/{types-Bk7lLMcF.d.ts → types-BiZanzz1.d.ts} +25 -136
- package/dist/plugins/cjs-interop.d.ts +11 -0
- package/dist/{packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs → plugins/cjs-interop.js} +1 -1
- package/dist/plugins/copy.d.ts +18 -0
- package/dist/plugins/copy.js +1 -0
- package/dist/plugins/data-uri.d.ts +12 -0
- package/dist/plugins/data-uri.js +1 -0
- package/dist/plugins/debarrel.d.ts +11 -0
- package/dist/{packem_shared/debarrelPlugin-BTYc859G.mjs → plugins/debarrel.js} +1 -1
- package/dist/plugins/esbuild/index.d.ts +19 -5
- package/dist/plugins/esbuild/index.js +1 -0
- package/dist/plugins/esm-shim-cjs-syntax.d.ts +13 -0
- package/dist/plugins/fix-dts-default-cjs-exports.d.ts +9 -0
- package/dist/plugins/fix-dts-default-cjs-exports.js +1 -0
- package/dist/plugins/isolated-declarations/index.d.ts +13 -0
- package/dist/{packem_shared/isolatedDeclarationsPlugin-B34s_qkE.mjs → plugins/isolated-declarations/index.js} +1 -1
- package/dist/plugins/json.d.ts +7 -0
- package/dist/plugins/json.js +1 -0
- package/dist/plugins/jsx-remove-attributes.d.ts +11 -0
- package/dist/plugins/jsx-remove-attributes.js +1 -0
- package/dist/plugins/license.d.ts +21 -0
- package/dist/plugins/license.js +13 -0
- package/dist/plugins/minify-html-literals/index.d.ts +96 -6
- package/dist/plugins/native-modules-plugin.d.ts +9 -0
- package/dist/plugins/oxc/index.d.ts +20 -6
- package/dist/plugins/oxc/index.js +1 -0
- package/dist/plugins/preserve-directives.d.ts +13 -0
- package/dist/{packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs → plugins/preserve-directives.js} +3 -3
- package/dist/plugins/raw.d.ts +11 -0
- package/dist/plugins/require-cjs-transformer.d.ts +17 -0
- package/dist/plugins/require-cjs-transformer.js +21 -0
- package/dist/plugins/shebang.d.ts +13 -0
- package/dist/plugins/source-maps.d.ts +11 -0
- package/dist/plugins/sucrase/index.d.ts +18 -4
- package/dist/plugins/swc/index.d.ts +19 -5
- package/dist/plugins/swc/index.js +1 -0
- package/dist/plugins/typescript/index.d.ts +20 -6
- package/dist/plugins/typescript/index.js +1 -0
- package/dist/plugins/url.d.ts +17 -0
- package/dist/plugins/url.js +1 -0
- package/package.json +86 -18
- package/dist/index.d.mts +0 -59
- package/dist/index.mjs +0 -1
- package/dist/packem_shared/browserslist-to-esbuild-DY9HwYtp.d.mts +0 -3
- package/dist/packem_shared/cachingPlugin-TWoY5ZxV.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/dataUriPlugin-BFb7bZZs.mjs +0 -1
- package/dist/packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs +0 -1
- package/dist/packem_shared/index-hWYvkB02.d.mts +0 -346
- package/dist/packem_shared/index-hWYvkB02.d.ts +0 -346
- 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/requireCJSTransformerPlugin-E2iuTrjs.mjs +0 -27
- package/dist/packem_shared/types-CMThMMkh.d.mts +0 -4337
- package/dist/packem_shared/urlPlugin-DJJrDWjj.mjs +0 -1
- package/dist/plugins/esbuild/index.d.mts +0 -28
- package/dist/plugins/esbuild/index.mjs +0 -1
- package/dist/plugins/minify-html-literals/index.d.mts +0 -5
- package/dist/plugins/oxc/index.d.mts +0 -31
- package/dist/plugins/oxc/index.mjs +0 -1
- package/dist/plugins/sucrase/index.d.mts +0 -22
- package/dist/plugins/swc/index.d.mts +0 -29
- package/dist/plugins/swc/index.mjs +0 -1
- package/dist/plugins/typescript/index.d.mts +0 -32
- 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/{index-QEzU3Fey.mjs → index-QEzU3Fey.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/{metafilePlugin-CVcqFpPJ.mjs → metafilePlugin-CVcqFpPJ.js} +0 -0
- /package/dist/packem_shared/{oxcTransformPlugin-DfVQouIB.mjs → oxcTransformPlugin-DfVQouIB.js} +0 -0
- /package/dist/packem_shared/{resolveFileUrlPlugin-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/plugins/minify-html-literals/{index.mjs → index.js} +0 -0
- /package/dist/{packem_shared/nativeModulesPlugin-D6lO-8g6.mjs → plugins/native-modules-plugin.js} +0 -0
- /package/dist/{packem_shared/rawPlugin-DgRj14Xy.mjs → plugins/raw.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
|
@@ -1 +1 @@
|
|
|
1
|
-
var v=Object.defineProperty;var
|
|
1
|
+
var v=Object.defineProperty;var a=(o,r)=>v(o,"name",{value:r,configurable:!0});import{join as d,resolve as p}from"@visulima/path";var g=Object.defineProperty,c=a((o,r)=>g(o,"name",{value:r,configurable:!0}),"u");const m=c((o,r)=>{if(!r)return;const{config:s,path:t}=r;if(!s.compilerOptions)return;const{rootDirs:e}=s.compilerOptions;if(!e)return;const n=[];for(const i of e){if(i.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${t}.`);if(i.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${t}.`);n.push(p(o,i))}return n},"getRootDirectories"),w=c((o,r,s)=>{const t=m(o,s);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(e,n,i){if(!(t===void 0||t.length===0)&&e.startsWith("."))for(const l of t){const u=d(l,e),f=await this.resolve(u,n,{skipSelf:!0,...i});if(f)return r.debug({message:`Resolved ${e} to ${f.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),f.id}}}},"resolveTsconfigRootDirectories");export{w as default};
|
|
@@ -6,144 +6,33 @@ import { RollupReplaceOptions } from '@rollup/plugin-replace';
|
|
|
6
6
|
import { RollupWasmOptions } from '@rollup/plugin-wasm';
|
|
7
7
|
import { FilterPattern } from '@rollup/pluginutils';
|
|
8
8
|
import { Plugin as Plugin$1, OutputOptions, RollupOptions } from 'rollup';
|
|
9
|
-
import { Options as Options$
|
|
9
|
+
import { Options as Options$3 } from 'rollup-plugin-dts';
|
|
10
10
|
import { NodePolyfillsOptions } from 'rollup-plugin-polyfill-node';
|
|
11
11
|
import { PureAnnotationsOptions } from 'rollup-plugin-pure';
|
|
12
12
|
import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
|
|
13
|
-
import {
|
|
13
|
+
import { CJSInteropOptions } from '../plugins/cjs-interop.js';
|
|
14
|
+
import { CopyPluginOptions } from '../plugins/copy.js';
|
|
15
|
+
import { DataUriPluginOptions } from '../plugins/data-uri.js';
|
|
16
|
+
import { DebarrelPluginOptions } from '../plugins/debarrel.js';
|
|
14
17
|
import { TransformOptions, Loader, BuildOptions } from 'esbuild';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
18
|
+
import { EsmShimCjsSyntaxOptions } from '../plugins/esm-shim-cjs-syntax.js';
|
|
19
|
+
import { IsolatedDeclarationsOptions } from '../plugins/isolated-declarations/index.js';
|
|
20
|
+
import { JSXRemoveAttributesPlugin } from '../plugins/jsx-remove-attributes.js';
|
|
21
|
+
import { LicenseOptions } from '../plugins/license.js';
|
|
22
|
+
import { MinifyHTMLLiteralsOptions } from '../plugins/minify-html-literals/index.js';
|
|
23
|
+
import { NativeModulesOptions } from '../plugins/native-modules-plugin.js';
|
|
17
24
|
import { NapiResolveOptions } from 'oxc-resolver';
|
|
18
25
|
import { TransformOptions as TransformOptions$1, JsxOptions } from 'oxc-transform';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
logger: PailServerType;
|
|
26
|
-
}) => Plugin$1;
|
|
27
|
-
|
|
28
|
-
type CopyPluginOptions = {
|
|
29
|
-
copyOnce?: boolean;
|
|
30
|
-
exactFileNames?: boolean;
|
|
31
|
-
flatten?: boolean;
|
|
32
|
-
targets: MultipleTargetsDesc;
|
|
33
|
-
};
|
|
34
|
-
type MultipleTargetsDesc = SingleTargetDesc | SingleTargetDesc[] | string[] | string;
|
|
35
|
-
type SingleTargetDesc = {
|
|
36
|
-
dest?: string;
|
|
37
|
-
exclude?: string[] | string;
|
|
38
|
-
src: string[] | string;
|
|
39
|
-
};
|
|
40
|
-
declare const copyPlugin: (options: CopyPluginOptions, logger: PailServerType) => Plugin$1;
|
|
41
|
-
|
|
42
|
-
type DataUriPluginOptions = {
|
|
43
|
-
exclude?: FilterPattern;
|
|
44
|
-
include?: FilterPattern;
|
|
45
|
-
srcset?: boolean;
|
|
46
|
-
};
|
|
47
|
-
declare const dataUriPlugin: (options?: DataUriPluginOptions) => Plugin$1;
|
|
48
|
-
|
|
49
|
-
interface DebarrelPluginOptions {
|
|
50
|
-
include?: FilterPattern;
|
|
51
|
-
possibleBarrelFiles?: (RegExp | string)[];
|
|
52
|
-
}
|
|
53
|
-
declare const debarrelPlugin: (options: DebarrelPluginOptions, logger: PailServerType) => Plugin$1;
|
|
54
|
-
|
|
55
|
-
interface EsmShimCjsSyntaxOptions {
|
|
56
|
-
exclude?: FilterPattern;
|
|
57
|
-
include?: FilterPattern;
|
|
58
|
-
}
|
|
59
|
-
declare const esmShimCjsSyntaxPlugin: (packageJson: PackageJson, options: EsmShimCjsSyntaxOptions) => Plugin$1;
|
|
60
|
-
|
|
61
|
-
type IsolatedDeclarationsOptions = {
|
|
62
|
-
exclude?: FilterPattern;
|
|
63
|
-
ignoreErrors?: boolean;
|
|
64
|
-
include?: FilterPattern;
|
|
65
|
-
};
|
|
66
|
-
declare const isolatedDeclarationsPlugin: <T extends Record<string, any>>(sourceDirectory: string, context: BuildContext<T>) => Plugin$1;
|
|
67
|
-
|
|
68
|
-
type JSXRemoveAttributesPlugin = {
|
|
69
|
-
attributes: string[];
|
|
70
|
-
};
|
|
71
|
-
declare const jsxRemoveAttributes: ({ attributes, logger }: JSXRemoveAttributesPlugin & {
|
|
72
|
-
logger: PailServerType;
|
|
73
|
-
}) => Plugin$1;
|
|
74
|
-
|
|
75
|
-
interface LicenseOptions {
|
|
76
|
-
dependenciesMarker?: string;
|
|
77
|
-
dependenciesTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
|
|
78
|
-
dtsMarker?: string;
|
|
79
|
-
dtsTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
|
|
80
|
-
path?: string;
|
|
81
|
-
}
|
|
82
|
-
declare const license: ({ dtsMarker, licenseFilePath, licenseTemplate, logger, marker, mode, packageName, }: {
|
|
83
|
-
dtsMarker?: string;
|
|
84
|
-
licenseFilePath: string;
|
|
85
|
-
licenseTemplate: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
|
|
86
|
-
logger: PailServerType;
|
|
87
|
-
marker: string;
|
|
88
|
-
mode: "dependencies" | "types";
|
|
89
|
-
packageName: string | undefined;
|
|
90
|
-
}) => Plugin$1;
|
|
91
|
-
|
|
92
|
-
interface NativeModulesOptions {
|
|
93
|
-
nativesDirectory?: string;
|
|
94
|
-
}
|
|
95
|
-
declare const nativeModulesPlugin: (config?: NativeModulesOptions) => Plugin$1;
|
|
96
|
-
|
|
97
|
-
interface RawLoaderOptions {
|
|
98
|
-
exclude?: FilterPattern;
|
|
99
|
-
include?: FilterPattern;
|
|
100
|
-
}
|
|
101
|
-
declare const rawPlugin: (options: RawLoaderOptions) => Plugin$1;
|
|
102
|
-
|
|
103
|
-
type Awaitable<T> = T | Promise<T>;
|
|
104
|
-
type TransformFunction = (id: string, importer: string, rollupResolve: (id: string, importer?: string) => Promise<{
|
|
105
|
-
id: string;
|
|
106
|
-
}>) => Awaitable<boolean | undefined | void>;
|
|
107
|
-
interface Options$2 {
|
|
108
|
-
builtinNodeModules?: boolean;
|
|
109
|
-
cwd?: string;
|
|
110
|
-
exclude?: FilterPattern;
|
|
111
|
-
include?: FilterPattern;
|
|
112
|
-
order?: "pre" | "post" | undefined;
|
|
113
|
-
shouldTransform?: string[] | TransformFunction;
|
|
114
|
-
}
|
|
115
|
-
declare const requireCJSTransformerPlugin: (userOptions: Options$2, logger: PailServerType) => Plugin$1;
|
|
116
|
-
|
|
117
|
-
type ShebangOptions = {
|
|
118
|
-
replace: boolean;
|
|
119
|
-
shebang: string;
|
|
120
|
-
};
|
|
121
|
-
declare const makeExecutable: (filePath: string) => Promise<void>;
|
|
122
|
-
declare const shebangPlugin: (executablePaths: string[], options: ShebangOptions) => Plugin$1;
|
|
123
|
-
declare const removeShebangPlugin: () => Plugin$1;
|
|
124
|
-
declare const getShebang: (code: string, append?: string) => string;
|
|
125
|
-
|
|
126
|
-
interface SourcemapsPluginOptions {
|
|
127
|
-
exclude?: FilterPattern;
|
|
128
|
-
include?: FilterPattern;
|
|
129
|
-
}
|
|
130
|
-
declare const sourcemapsPlugin: ({ exclude, include }?: SourcemapsPluginOptions) => Plugin$1;
|
|
131
|
-
|
|
132
|
-
interface UrlOptions {
|
|
133
|
-
destDir?: string;
|
|
134
|
-
emitFiles: boolean;
|
|
135
|
-
exclude?: FilterPattern;
|
|
136
|
-
fileName: string;
|
|
137
|
-
include?: FilterPattern;
|
|
138
|
-
limit: number;
|
|
139
|
-
publicPath?: string;
|
|
140
|
-
sourceDir?: string;
|
|
141
|
-
}
|
|
142
|
-
declare const urlPlugin: ({ destDir: destinationDirectory, emitFiles, exclude, fileName, include, limit, publicPath, sourceDir: sourceDirectory, }: UrlOptions) => Plugin$1;
|
|
26
|
+
import { RawLoaderOptions } from '../plugins/raw.js';
|
|
27
|
+
import { Options as Options$4 } from '../plugins/require-cjs-transformer.js';
|
|
28
|
+
import { ShebangOptions } from '../plugins/shebang.js';
|
|
29
|
+
import { SourcemapsPluginOptions } from '../plugins/source-maps.js';
|
|
30
|
+
import { Options as Options$2 } from 'sucrase';
|
|
31
|
+
import { UrlOptions } from '../plugins/url.js';
|
|
143
32
|
|
|
144
33
|
type MarkOptional<Type, Keys extends keyof Type> = Type extends Type ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
|
|
145
34
|
type EsbuildPluginConfig = Options$1 & {
|
|
146
|
-
logger:
|
|
35
|
+
logger: Console;
|
|
147
36
|
};
|
|
148
37
|
type Optimized = Map<string, {
|
|
149
38
|
file: string;
|
|
@@ -180,7 +69,7 @@ type OxcResolveOptions = Omit<NapiResolveOptions, "tsconfig"> & {
|
|
|
180
69
|
ignoreSideEffectsForRoot?: boolean;
|
|
181
70
|
};
|
|
182
71
|
|
|
183
|
-
interface SucrasePluginConfig extends Options$
|
|
72
|
+
interface SucrasePluginConfig extends Options$2 {
|
|
184
73
|
exclude?: FilterPattern;
|
|
185
74
|
include?: FilterPattern;
|
|
186
75
|
}
|
|
@@ -2300,7 +2189,7 @@ type SwcPluginConfig = Exclude<Options, "configFile" | "exclude" | "filename" |
|
|
|
2300
2189
|
type PatchTypesOptions = {
|
|
2301
2190
|
identifierReplacements?: Record<string, Record<string, string>>;
|
|
2302
2191
|
};
|
|
2303
|
-
declare const patchTypescriptTypes: (options: PatchTypesOptions, logger:
|
|
2192
|
+
declare const patchTypescriptTypes: (options: PatchTypesOptions, logger: Console) => Plugin$1;
|
|
2304
2193
|
|
|
2305
2194
|
declare global {
|
|
2306
2195
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
@@ -4261,7 +4150,7 @@ type TsConfigResult = {
|
|
|
4261
4150
|
type TsconfigPathsPluginOptions = {
|
|
4262
4151
|
resolveAbsolutePath?: boolean;
|
|
4263
4152
|
};
|
|
4264
|
-
declare const resolveTsconfigPathsPlugin: (rootDirectory: string, tsconfig: TsConfigResult, logger:
|
|
4153
|
+
declare const resolveTsconfigPathsPlugin: (rootDirectory: string, tsconfig: TsConfigResult, logger: Console, pluginOptions: TsconfigPathsPluginOptions) => Plugin$1;
|
|
4265
4154
|
|
|
4266
4155
|
interface RollupDynamicImportVariablesOptions {
|
|
4267
4156
|
errorWhenNoFilesFound?: boolean;
|
|
@@ -4282,7 +4171,7 @@ interface PackemRollupOptions {
|
|
|
4282
4171
|
copy?: CopyPluginOptions | false;
|
|
4283
4172
|
dataUri?: DataUriPluginOptions | false;
|
|
4284
4173
|
debarrel?: DebarrelPluginOptions | false;
|
|
4285
|
-
dts: Options$
|
|
4174
|
+
dts: Options$3;
|
|
4286
4175
|
dynamicVars?: RollupDynamicImportVariablesOptions | false;
|
|
4287
4176
|
esbuild?: Options$1 | false;
|
|
4288
4177
|
experimental?: {
|
|
@@ -4309,7 +4198,7 @@ interface PackemRollupOptions {
|
|
|
4309
4198
|
preserveDynamicImports?: boolean;
|
|
4310
4199
|
raw?: RawLoaderOptions | false;
|
|
4311
4200
|
replace: Omit<RollupReplaceOptions, "cwd"> | false;
|
|
4312
|
-
requireCJS?: Options$
|
|
4201
|
+
requireCJS?: Options$4 | false;
|
|
4313
4202
|
resolve: RollupNodeResolveOptions | false;
|
|
4314
4203
|
shebang?: Partial<ShebangOptions> | false;
|
|
4315
4204
|
shim?: EsmShimCjsSyntaxOptions | false;
|
|
@@ -4333,5 +4222,5 @@ type TransformerFn = ((config: EsbuildPluginConfig | InternalOXCTransformPluginC
|
|
|
4333
4222
|
};
|
|
4334
4223
|
type TransformerName = "esbuild" | "oxc" | "sucrase" | "swc";
|
|
4335
4224
|
|
|
4336
|
-
export {
|
|
4337
|
-
export type {
|
|
4225
|
+
export { patchTypescriptTypes as p, resolveTsconfigPathsPlugin as r, sucrasePlugin as s };
|
|
4226
|
+
export type { EsbuildPluginConfig as E, IsolatedDeclarationsResult as I, Optimized as O, PackemRollupOptions as P, RollupPlugins as R, SwcPluginConfig as S, TransformerFn as T, IsolatedDeclarationsTransformer as a, TransformerName as b, OptimizeDepsOptions as c, OptimizeDepsResult as d, Options$1 as e, TsConfigResult as f, PatchTypesOptions as g, TsconfigPathsPluginOptions as h, OxcResolveOptions as i, InternalOXCTransformPluginConfig as j, OXCTransformPluginConfig as k, SucrasePluginConfig as l };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from 'rollup';
|
|
2
|
+
|
|
3
|
+
interface CJSInteropOptions {
|
|
4
|
+
addDefaultProperty?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const cjsInteropPlugin: ({ addDefaultProperty, logger, }: CJSInteropOptions & {
|
|
7
|
+
logger: Console;
|
|
8
|
+
}) => Plugin;
|
|
9
|
+
|
|
10
|
+
export { cjsInteropPlugin };
|
|
11
|
+
export type { CJSInteropOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=Object.defineProperty;var l=(e,r)=>c(e,"name",{value:r,configurable:!0});import d from"magic-string";var i=Object.defineProperty,s=l((e,r)=>i(e,"name",{value:r,configurable:!0}),"u");const g=s(({addDefaultProperty:e=!1,logger:r})=>({name:"packem:cjs-interop",renderChunk:s(async(u,o,a)=>{if(!(o.type!=="chunk"||!o.isEntry)&&a.format==="cjs"&&a.exports==="auto"){const n=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(u);if(n===null||n.length<3)return;const t=new d(u);t.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),t.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&t.append(`
|
|
2
2
|
module.exports.default = ${n[2]};`);let p=t.toString();return p=p.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),r.debug({message:`Applied CommonJS interop to entry chunk ${o.fileName}.`,prefix:"plugin:cjs-interop"}),{code:p,map:t.generateMap({hires:!0})}}},"renderChunk")}),"cjsInteropPlugin");export{g as cjsInteropPlugin};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Plugin } from 'rollup';
|
|
2
|
+
|
|
3
|
+
type CopyPluginOptions = {
|
|
4
|
+
copyOnce?: boolean;
|
|
5
|
+
exactFileNames?: boolean;
|
|
6
|
+
flatten?: boolean;
|
|
7
|
+
targets: MultipleTargetsDesc;
|
|
8
|
+
};
|
|
9
|
+
type MultipleTargetsDesc = SingleTargetDesc | SingleTargetDesc[] | string[] | string;
|
|
10
|
+
type SingleTargetDesc = {
|
|
11
|
+
dest?: string;
|
|
12
|
+
exclude?: string[] | string;
|
|
13
|
+
src: string[] | string;
|
|
14
|
+
};
|
|
15
|
+
declare const copyPlugin: (options: CopyPluginOptions, logger: Console) => Plugin;
|
|
16
|
+
|
|
17
|
+
export { copyPlugin };
|
|
18
|
+
export type { CopyPluginOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var g=Object.defineProperty;var l=(n,a)=>g(n,"name",{value:a,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((n,a)=>A(n,"name",{value:a,configurable:!0}),"f");const C=j((n,a)=>{const c=new Map,p={copyOnce:!0,exactFileNames:!0,flatten:!1,...n};let{targets:s}=p;return Array.isArray(s)?s=s.map(o=>{if(typeof o=="string")return{src:o};if(typeof o=="object"&&"src"in o)return o}).filter(Boolean):typeof s=="string"&&(s=[{src:s}]),{async buildStart(){const o=await Promise.all(s.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 o)for(const r of e.src){let i;c.has(r)?i=c.get(r):(i={copied:[],dest:[],timestamp:0},c.set(r,i));const t=p.flatten?b(e.dest):y(e.dest,w(e.parent,F(r)));i.dest.includes(t)||i.dest.push(t),this.addWatchFile(r)}a.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...c].map(async([e,r])=>{let i;try{const t=await x(e);if(!t.isFile())return;const m=t.mtime.getTime();m>r.timestamp&&(r.timestamp=m,r.copied=[]),i=await h(e,{buffer:!0})}catch(t){a.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:i,type:"asset"}),a.debug({message:`copied ${e} → ${f}`,prefix:"plugin:copy"}),r.copied.push(t)}catch(d){a.error({context:[d],message:`error copying file ${e} → ${f}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");export{C as copyPlugin};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
2
|
+
import { Plugin } from 'rollup';
|
|
3
|
+
|
|
4
|
+
type DataUriPluginOptions = {
|
|
5
|
+
exclude?: FilterPattern;
|
|
6
|
+
include?: FilterPattern;
|
|
7
|
+
srcset?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const dataUriPlugin: (options?: DataUriPluginOptions) => Plugin;
|
|
10
|
+
|
|
11
|
+
export { dataUriPlugin, dataUriPlugin as default };
|
|
12
|
+
export type { DataUriPluginOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var c=(a,e)=>p(a,"name",{value:e,configurable:!0});import{createFilter as g}from"@rollup/pluginutils";import{readFile as u}from"@visulima/fs";import{svgToCssDataUri as h,svgToTinyDataUri as b}from"@visulima/packem-share";import{R as v}from"../packem_shared/index-QEzU3Fey.js";var x=Object.defineProperty,$=c((a,e)=>x(a,"name",{value:e,configurable:!0}),"l");const F=$((a={})=>{const e=g(a.include??[/\?data-uri/],a.exclude);return{async load(s){if(!e(s)||!s.includes("?data-uri"))return;const i=new URL(s,"file://"),t=i.pathname,f=i.searchParams.get("encoding")||"tiny",l=i.searchParams.has("srcset")||a.srcset;this.addWatchFile(t);const r=v.getType(t)||"application/octet-stream";if(r==="image/svg+xml"){const n=await u(t,{buffer:!1}),o=f==="css"?h(n):b(n);return`export default "${l?o.replaceAll(" ","%20"):o}"`}const d=await u(t,{buffer:!0}),m=Buffer.from(d).toString("base64");return`export default "${`${r.startsWith("text/")?`data:${r};charset=utf-8;base64,`:`data:${r};base64,`}${m}`}"`},name:"packem:data-uri"}},"dataUriPlugin");export{F as dataUriPlugin,F as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
2
|
+
import { Plugin } from 'rollup';
|
|
3
|
+
|
|
4
|
+
interface DebarrelPluginOptions {
|
|
5
|
+
include?: FilterPattern;
|
|
6
|
+
possibleBarrelFiles?: (RegExp | string)[];
|
|
7
|
+
}
|
|
8
|
+
declare const debarrelPlugin: (options: DebarrelPluginOptions, logger: Console) => Plugin;
|
|
9
|
+
|
|
10
|
+
export { debarrelPlugin };
|
|
11
|
+
export type { DebarrelPluginOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
var I=Object.defineProperty;var $=(e,t)=>I(e,"name",{value:t,configurable:!0});import S from"node:fs/promises";import{createFilter as j}from"@rollup/pluginutils";import M from"magic-string";import*as B from"rs-module-lexer";var E=Object.defineProperty,d=$((e,t)=>E(e,"name",{value:t,configurable:!0}),"u");const A=/\.[mc]?tsx?(?:\?.*)?$/,D=/(?:\.(?:[tj]s|[tj]sx)|\/index\.(?:[tj]s|[tj]sx))(?:\?.*)?$/,O=/^\s*export/,_={exports:[],facade:!1,imports:[]},y=d(e=>A.test(e),"isSourceFile"),b=d(e=>e.includes("/build/cache/vite/")||e.includes("/node_modules/"),"isIgnoredModule"),k=d((e,t)=>b(e)?!1:D.test(e)?!0:t.possibleBarrelFiles?t.possibleBarrelFiles.some(s=>e.match(s)):!1,"isPossibleBarrelSpecifier"),N=d(e=>O.test(e)?"export":"import","getDeclarationKind"),{parseAsync:z}=B,C=d(async(e,t,s)=>{try{const{output:r}=await z({input:[{code:t,filename:e}]});return r[0]}catch(r){return s.warn({message:`Failed to parse ${e}:
|
|
2
|
-
${r instanceof Error?r.message:String(r)}`,prefix:"plugin:debarrel"}),_}},"safeParse"),K=d(async(e,t,s,r)=>{const a=e.parseCache.get(t);if(a!==void 0)return a;const o=await C(t,s,r);return e.parseCache.set(t,o),o},"parsePotentialBarrelFile"),R=d((e,t)=>{const s=e.fileCache.get(t);if(s!==void 0)return s;const r=S.readFile(t,"utf8");return e.fileCache.set(t,r),r},"readFileCached"),P=d(e=>{const t=/^(?:import|export)\s+([\w$]+)/,s=/([\w$]+)\s*,\s*\{|\}\s*,\s*([\w$]+)/,r=/[{,]\s*(type\s+)?([\w$]+)(?:\s+as\s+([\w$]+))?/gi;r.lastIndex=0;const a=[];if(e.includes("*"))return a;if(!e.includes("{")){const i=e.match(t);return i&&a.push({imported:"default",local:i[1]}),a}const o=e.match(s);o&&a.push({imported:"default",local:o[1]||o[2]});let n;for(;n=r.exec(e);)n[1]||n[2]&&a.push({imported:n[2],local:n[3]});return a},"getImportNames"),T=d((e,t,s)=>{let r=e.ln,a=t.find(o=>o.ss<e.s&&o.se>e.e&&o.d===-1);if(!a||!a.n){const o=r||s.slice(e.s).match(/default\s+([a-zA-Z_$][\w$]*)(?:;|\n|$)/)?.[1];o&&(a=t.find(n=>{const i=P(s.slice(n.ss,n.s)).find(c=>c.local===o);return i&&(r=i.imported),i}))}if(a&&!r){const o=s.slice(a.ss,e.s);if(!o.includes("*")){const n=o.match(/([\w$]+)\s*as\s*$/)?.[1];n&&(r=n)}}return{imp:a,localExportName:r}},"findMatchingImport"),v=d(async(e,t,s,r,a)=>{const{resolve:o}=e,n=await R(e,t),{exports:i,imports:c}=await K(e,t,n,a);for await(const l of i){const p=l.n;if(p!==s)continue;const u=T(l,c,n),{imp:f,localExportName:
|
|
2
|
+
${r instanceof Error?r.message:String(r)}`,prefix:"plugin:debarrel"}),_}},"safeParse"),K=d(async(e,t,s,r)=>{const a=e.parseCache.get(t);if(a!==void 0)return a;const o=await C(t,s,r);return e.parseCache.set(t,o),o},"parsePotentialBarrelFile"),R=d((e,t)=>{const s=e.fileCache.get(t);if(s!==void 0)return s;const r=S.readFile(t,"utf8");return e.fileCache.set(t,r),r},"readFileCached"),P=d(e=>{const t=/^(?:import|export)\s+([\w$]+)/,s=/([\w$]+)\s*,\s*\{|\}\s*,\s*([\w$]+)/,r=/[{,]\s*(type\s+)?([\w$]+)(?:\s+as\s+([\w$]+))?/gi;r.lastIndex=0;const a=[];if(e.includes("*"))return a;if(!e.includes("{")){const i=e.match(t);return i&&a.push({imported:"default",local:i[1]}),a}const o=e.match(s);o&&a.push({imported:"default",local:o[1]||o[2]});let n;for(;n=r.exec(e);)n[1]||n[2]&&a.push({imported:n[2],local:n[3]});return a},"getImportNames"),T=d((e,t,s)=>{let r=e.ln,a=t.find(o=>o.ss<e.s&&o.se>e.e&&o.d===-1);if(!a||!a.n){const o=r||s.slice(e.s).match(/default\s+([a-zA-Z_$][\w$]*)(?:;|\n|$)/)?.[1];o&&(a=t.find(n=>{const i=P(s.slice(n.ss,n.s)).find(c=>c.local===o);return i&&(r=i.imported),i}))}if(a&&!r){const o=s.slice(a.ss,e.s);if(!o.includes("*")){const n=o.match(/([\w$]+)\s*as\s*$/)?.[1];n&&(r=n)}}return{imp:a,localExportName:r}},"findMatchingImport"),v=d(async(e,t,s,r,a)=>{const{resolve:o}=e,n=await R(e,t),{exports:i,imports:c}=await K(e,t,n,a);for await(const l of i){const p=l.n;if(p!==s)continue;const u=T(l,c,n),{imp:f,localExportName:w}=u;if(!f||!f.n)return{exportName:s,id:t,resolved:!0};if(f.d>-1)return{exportName:s,id:t,resolved:!0};let h;const g=n.slice(f.ss,l.s);if(N(g)==="import"&&/\bas\b/.test(g)){const F=new RegExp(`(\\w+)\\s+as\\s+${s}(?!\\w)`);h=g.match(F)?.[0]}const x=(await o(f.n,t))?.id;return x?k(x,r)?v(e,x,w||p,r,a):{aliasedImportName:h,exportName:w||s,id:x,resolved:!1}:{aliasedImportName:h,exportName:w,id:t,resolved:!1}}const m=c.filter(l=>/^export\s+\*(?!\s+as)/.test(n.slice(l.ss,l.s)));if(m.length===1){const l=m[0]?.n,p=l?(await e.resolve(l,t))?.id:void 0;if(!p)return{exportName:s,id:t,resolved:!1};const u=await v(e,p,s,r);if(u.resolved)return u}else if(m.length>1){const l=(await Promise.all(m.map(async p=>{const u=p.n,f=u?(await e.resolve(u,t))?.id:void 0;if(f)return v(e,f,s,r)}))).find(p=>p?.resolved);if(l)return l}return{exportName:s,id:t,resolved:!1}},"resolveThroughBarrel"),J=d((e,t,s)=>{const{aliasedImportName:r,exportName:a}=e,o=t.local||t.imported;return r?`{${r}}`:a==="default"&&s!=="export"?o:`{${a!==o?`${a} as ${o}`:a}}`},"getDeclarationClause"),L=d(async(e,t,s,r,a)=>{const o=[],{imports:n}=await C(t,s,a);return await Promise.all(n.map(async i=>{if(!i.n||i.d!==-1)return;const c=s.slice(i.ss,i.s),m=P(c);if(m.length===0)return;const l=(await e.resolve(i.n,t))?.id;if(!l||!y(l)||b(l))return;const p=N(c);try{const u=await Promise.all(m.map(async f=>{const w=await v(e,l,f.imported,r);if(!w)return;const h=J(w,f,p),g=JSON.stringify(w.id);return`${p} ${h} from ${g}`}));if(u.includes(void 0))return;o.push([i.ss,i.se,u.join(";")])}catch(u){a.warn({context:{error:u},message:u.toString(),prefix:"plugin:debarrel"})}})),o},"getDebarrelModifications"),X=d((e,t,s,r)=>{if(s.length===0)return;const a=new M(t,{filename:e});for(const[o,n,i]of s)a.update(o,n,i);return{code:a.toString(),map:r?a.generateMap({file:e}):void 0}},"applyModifications"),Q=d((e,t)=>{const s=new Map,r=new Map,a=d(()=>{s.clear(),r.clear()},"purgeCaches"),o=e.include?j(e.include,[]):void 0;let n=!0;return{buildEnd:a,buildStart:a,async load(i){const c=s.get(i);if(c)return await c},name:"packem:debarrel",options(i){(i.output&&(Array.isArray(i.output)?i.output[0]?.sourcemap:i.output?.sourcemap))===!1&&(n=!1)},async transform(i,c){if(!y(c)||o&&!o(c))return;const m={fileCache:s,parseCache:r,resolve:this.resolve.bind(this)},l=await L(m,c,i,e,t);return X(c,i,l,n)},watchChange(i){s.delete(i),r.delete(i)}}},"debarrelPlugin");export{Q as debarrelPlugin};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { b as browserslistToEsbuild } from '../../packem_shared/browserslist-to-esbuild-DY9HwYtp.js';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { T as TransformerFn } from '../../packem_shared/types-BiZanzz1.js';
|
|
3
|
+
export { E as EsbuildPluginConfig, c as OptimizeDepsOptions, d as OptimizeDepsResult, O as Optimized, e as Options } from '../../packem_shared/types-BiZanzz1.js';
|
|
4
4
|
import '@rollup/plugin-alias';
|
|
5
5
|
import '@rollup/plugin-commonjs';
|
|
6
6
|
import '@rollup/plugin-json';
|
|
@@ -13,15 +13,29 @@ import 'rollup-plugin-dts';
|
|
|
13
13
|
import 'rollup-plugin-polyfill-node';
|
|
14
14
|
import 'rollup-plugin-pure';
|
|
15
15
|
import 'rollup-plugin-visualizer';
|
|
16
|
-
import '
|
|
17
|
-
import '
|
|
18
|
-
import '
|
|
16
|
+
import '../cjs-interop.js';
|
|
17
|
+
import '../copy.js';
|
|
18
|
+
import '../data-uri.js';
|
|
19
|
+
import '../debarrel.js';
|
|
19
20
|
import 'esbuild';
|
|
21
|
+
import '../esm-shim-cjs-syntax.js';
|
|
20
22
|
import '@visulima/package';
|
|
23
|
+
import '../isolated-declarations/index.js';
|
|
21
24
|
import '@visulima/packem-share/types';
|
|
25
|
+
import '../jsx-remove-attributes.js';
|
|
26
|
+
import '../license.js';
|
|
27
|
+
import '../minify-html-literals/index.js';
|
|
28
|
+
import 'magic-string';
|
|
29
|
+
import 'html-minifier-next';
|
|
30
|
+
import '../native-modules-plugin.js';
|
|
22
31
|
import 'oxc-resolver';
|
|
23
32
|
import 'oxc-transform';
|
|
33
|
+
import '../raw.js';
|
|
34
|
+
import '../require-cjs-transformer.js';
|
|
35
|
+
import '../shebang.js';
|
|
36
|
+
import '../source-maps.js';
|
|
24
37
|
import 'sucrase';
|
|
38
|
+
import '../url.js';
|
|
25
39
|
|
|
26
40
|
declare const _default: TransformerFn;
|
|
27
41
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as l}from"../../packem_shared/browserslistToEsbuild-C0IWmbNe.js";import{default as r}from"../../packem_shared/esbuildPlugin-DpLtQGuZ.js";export{l as browserslistToEsbuild,r as esbuildPlugin};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
2
|
+
import { PackageJson } from '@visulima/package';
|
|
3
|
+
import { Plugin } from 'rollup';
|
|
4
|
+
|
|
5
|
+
declare const GLOBAL_REQUIRE_REGEX: RegExp;
|
|
6
|
+
interface EsmShimCjsSyntaxOptions {
|
|
7
|
+
exclude?: FilterPattern;
|
|
8
|
+
include?: FilterPattern;
|
|
9
|
+
}
|
|
10
|
+
declare const esmShimCjsSyntaxPlugin: (packageJson: PackageJson, options: EsmShimCjsSyntaxOptions) => Plugin;
|
|
11
|
+
|
|
12
|
+
export { GLOBAL_REQUIRE_REGEX, esmShimCjsSyntaxPlugin };
|
|
13
|
+
export type { EsmShimCjsSyntaxOptions };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RenderedChunk, Plugin } from 'rollup';
|
|
2
|
+
|
|
3
|
+
type FixDtsDefaultCjsExportsPluginOptions = {
|
|
4
|
+
matcher?: (info: RenderedChunk) => boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const fixDtsDefaultCjsExportsPlugin: (options?: FixDtsDefaultCjsExportsPluginOptions) => Plugin;
|
|
7
|
+
|
|
8
|
+
export { fixDtsDefaultCjsExportsPlugin };
|
|
9
|
+
export type { FixDtsDefaultCjsExportsPluginOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var n=(e,r)=>i(e,"name",{value:r,configurable:!0});import{_ as o}from"../packem_shared/fix-dts-default-cjs-exports-BQc0nwIG.js";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};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
2
|
+
import { BuildContext } from '@visulima/packem-share/types';
|
|
3
|
+
import { Plugin } from 'rollup';
|
|
4
|
+
|
|
5
|
+
type IsolatedDeclarationsOptions = {
|
|
6
|
+
exclude?: FilterPattern;
|
|
7
|
+
ignoreErrors?: boolean;
|
|
8
|
+
include?: FilterPattern;
|
|
9
|
+
};
|
|
10
|
+
declare const isolatedDeclarationsPlugin: <T extends Record<string, any>>(sourceDirectory: string, context: BuildContext<T>) => Plugin;
|
|
11
|
+
|
|
12
|
+
export { isolatedDeclarationsPlugin };
|
|
13
|
+
export type { IsolatedDeclarationsOptions };
|
|
@@ -1,3 +1,3 @@
|
|
|
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"
|
|
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"../../packem_shared/fix-dts-default-cjs-exports-BQc0nwIG.js";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
2
|
//# sourceMappingURL=${F(e)}.map
|
|
3
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var t=(r,o)=>c(r,"name",{value:o,configurable:!0});import l from"@rollup/plugin-json";var u=Object.defineProperty,i=t((r,o)=>u(r,"name",{value:o,configurable:!0}),"l");const n="export default ",d=i(r=>{const o=l(r);return{...o,name:"packem:json",transform(s,a){const e=o.transform?.call(this,s,a);return e&&typeof e!="string"&&"code"in e&&e.code?.startsWith(n)&&(e.code=e.code.replace(n,"module.exports = ")),e}}},"JsonPlugin");export{d as JsonPlugin};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Plugin } from 'rollup';
|
|
2
|
+
|
|
3
|
+
type JSXRemoveAttributesPlugin = {
|
|
4
|
+
attributes: string[];
|
|
5
|
+
};
|
|
6
|
+
declare const jsxRemoveAttributes: ({ attributes, logger }: JSXRemoveAttributesPlugin & {
|
|
7
|
+
logger: Console;
|
|
8
|
+
}) => Plugin;
|
|
9
|
+
|
|
10
|
+
export { jsxRemoveAttributes };
|
|
11
|
+
export type { JSXRemoveAttributesPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
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"../packem_shared/index-Dq8IUFTs.js";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};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Plugin } from 'rollup';
|
|
2
|
+
|
|
3
|
+
interface LicenseOptions {
|
|
4
|
+
dependenciesMarker?: string;
|
|
5
|
+
dependenciesTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
|
|
6
|
+
dtsMarker?: string;
|
|
7
|
+
dtsTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
|
|
8
|
+
path?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const licensePlugin: ({ dtsMarker, licenseFilePath, licenseTemplate, logger, marker, mode, packageName, }: {
|
|
11
|
+
dtsMarker?: string;
|
|
12
|
+
licenseFilePath: string;
|
|
13
|
+
licenseTemplate: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
|
|
14
|
+
logger: Console;
|
|
15
|
+
marker: string;
|
|
16
|
+
mode: "dependencies" | "types";
|
|
17
|
+
packageName: string | undefined;
|
|
18
|
+
}) => Plugin;
|
|
19
|
+
|
|
20
|
+
export { licensePlugin };
|
|
21
|
+
export type { LicenseOptions };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var P=Object.defineProperty;var h=(r,e)=>P(r,"name",{value:e,configurable:!0});import{readFileSync as b,writeFileSync as v}from"@visulima/fs";import{replaceContentWithinMarker as w}from"@visulima/packem-share/utils";import F from"rollup-plugin-license";var N=Object.defineProperty,y=h((r,e)=>N(r,"name",{value:e,configurable:!0}),"d");const C=y(r=>{const e=[],c=[];return r.forEach(t=>{t.startsWith("(")?e.push(t):c.push(t)}),[...c.toSorted(),...e.toSorted()]},"sortLicenses"),z=y(({dtsMarker:r,licenseFilePath:e,licenseTemplate:c,logger:t,marker:s,mode:m,packageName:S})=>F({thirdParty(x){const u=new Set,d=x.toSorted(({name:n},{name:i})=>(n||0)>(i||0)?1:(i||0)>(n||0)?-1:0).map(({author:n,contributors:i,license:a,licenseText:$,maintainers:j,name:k,repository:p})=>{let l=`## ${k}
|
|
2
|
+
`;a&&(l+=`License: ${a}
|
|
3
|
+
`);const f=new Set;for(const o of[n,...j,...i]){const g=typeof o=="string"?o:o?.name;g&&f.add(g)}return f.size>0&&(l+=`By: ${[...f].join(", ")}
|
|
4
|
+
`),p&&(l+=`Repository: ${typeof p=="string"?p:p.url}
|
|
5
|
+
`),$&&(l+=`
|
|
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
|
+
`),a&&u.add(a),l}).join(`
|
|
11
|
+
---------------------------------------
|
|
12
|
+
|
|
13
|
+
`);if(d===""){t.info({message:"No dependencies license information found.",prefix:`plugin:license:${m}`});return}const A=c(C(u),d,S);try{const n=b(e),i=w(n,s,A);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)}}}),"licensePlugin");export{z as licensePlugin};
|
|
@@ -1,6 +1,96 @@
|
|
|
1
|
-
import '@rollup/pluginutils';
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
2
|
+
import { Plugin } from 'rollup';
|
|
3
|
+
import { SourceMapOptions } from 'magic-string';
|
|
4
|
+
import { MinifierOptions } from 'html-minifier-next';
|
|
5
|
+
|
|
6
|
+
interface Template {
|
|
7
|
+
parts: TemplatePart[];
|
|
8
|
+
tag?: string;
|
|
9
|
+
}
|
|
10
|
+
interface TemplatePart {
|
|
11
|
+
end: number;
|
|
12
|
+
start: number;
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
interface Strategy$1<N = unknown> {
|
|
16
|
+
getRootNode: (source: string, fileName?: string) => N;
|
|
17
|
+
getTaggedTemplateTemplate: (node: N) => unknown;
|
|
18
|
+
getTagText: (node: N) => string;
|
|
19
|
+
getTemplateParts: (node: N) => TemplatePart[];
|
|
20
|
+
isTaggedTemplate: (node: N) => boolean;
|
|
21
|
+
isTemplate: (node: N) => boolean;
|
|
22
|
+
walkNodes: (parent: N, visit: (child: N) => void) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ParseLiteralsOptions {
|
|
26
|
+
fileName?: string;
|
|
27
|
+
strategy?: Partial<Strategy$1<unknown>>;
|
|
28
|
+
}
|
|
29
|
+
declare const parseLiterals: (source: string, options?: ParseLiteralsOptions) => Template[];
|
|
30
|
+
|
|
31
|
+
interface Strategy<O = unknown, C = unknown> {
|
|
32
|
+
combineHTMLStrings: (parts: TemplatePart[], placeholder: string) => string;
|
|
33
|
+
getPlaceholder: (parts: TemplatePart[]) => string;
|
|
34
|
+
minifyCSS?: (css: string, options?: C) => string;
|
|
35
|
+
minifyHTML: (html: string, options?: O) => string | Promise<string>;
|
|
36
|
+
splitHTMLByPlaceholder: (html: string, placeholder: string) => string[];
|
|
37
|
+
}
|
|
38
|
+
declare const defaultMinifyOptions: MinifierOptions;
|
|
39
|
+
|
|
40
|
+
type Options = DefaultOptions | CustomOptions<unknown>;
|
|
41
|
+
interface DefaultOptions extends BaseOptions {
|
|
42
|
+
minifyOptions?: Partial<typeof defaultMinifyOptions>;
|
|
43
|
+
}
|
|
44
|
+
interface CustomOptions<S extends Strategy | unknown> extends BaseOptions {
|
|
45
|
+
minifyOptions?: S extends Strategy<infer O> ? Partial<O> : never;
|
|
46
|
+
strategy: S;
|
|
47
|
+
}
|
|
48
|
+
interface BaseOptions {
|
|
49
|
+
fileName?: string;
|
|
50
|
+
generateSourceMap?: ((ms: MagicStringLike, fileName: string) => SourceMap | undefined) | false;
|
|
51
|
+
MagicString?: new (source: string) => MagicStringLike;
|
|
52
|
+
parseLiterals?: typeof parseLiterals;
|
|
53
|
+
parseLiteralsOptions?: Partial<ParseLiteralsOptions>;
|
|
54
|
+
shouldMinify?: (template: Template) => boolean;
|
|
55
|
+
shouldMinifyCSS?: (template: Template) => boolean;
|
|
56
|
+
validate?: Validation | false;
|
|
57
|
+
}
|
|
58
|
+
interface MagicStringLike {
|
|
59
|
+
generateMap: (options?: Partial<SourceMapOptions>) => SourceMap;
|
|
60
|
+
overwrite: (start: number, end: number, content: string) => unknown;
|
|
61
|
+
toString: () => string;
|
|
62
|
+
}
|
|
63
|
+
interface SourceMap {
|
|
64
|
+
file?: string;
|
|
65
|
+
mappings: string;
|
|
66
|
+
names: string[];
|
|
67
|
+
sources: string[];
|
|
68
|
+
sourcesContent?: string[];
|
|
69
|
+
toString: () => string;
|
|
70
|
+
toUrl: () => string;
|
|
71
|
+
version: number;
|
|
72
|
+
}
|
|
73
|
+
interface Validation {
|
|
74
|
+
ensureHTMLPartsValid: (parts: TemplatePart[], htmlParts: string[]) => void;
|
|
75
|
+
ensurePlaceholderValid: (placeholder: unknown) => void;
|
|
76
|
+
}
|
|
77
|
+
interface Result {
|
|
78
|
+
code: string;
|
|
79
|
+
map: SourceMap | undefined;
|
|
80
|
+
}
|
|
81
|
+
declare function minifyHTMLLiterals(source: string, options?: DefaultOptions): Promise<Result | null>;
|
|
82
|
+
declare function minifyHTMLLiterals<S extends Strategy>(source: string, options?: CustomOptions<S>): Promise<Result | null>;
|
|
83
|
+
|
|
84
|
+
interface MinifyHTMLLiteralsOptions {
|
|
85
|
+
exclude?: FilterPattern;
|
|
86
|
+
failOnError?: boolean;
|
|
87
|
+
include?: FilterPattern;
|
|
88
|
+
minifyHTMLLiterals?: typeof minifyHTMLLiterals;
|
|
89
|
+
options?: Partial<Options>;
|
|
90
|
+
}
|
|
91
|
+
declare const minifyHTMLLiteralsPlugin: ({ exclude, failOnError, include, logger, minifyHTMLLiterals, options, }: MinifyHTMLLiteralsOptions & {
|
|
92
|
+
logger: Console;
|
|
93
|
+
}) => Plugin;
|
|
94
|
+
|
|
95
|
+
export { minifyHTMLLiteralsPlugin as default, minifyHTMLLiteralsPlugin };
|
|
96
|
+
export type { MinifyHTMLLiteralsOptions };
|