@visulima/packem-rollup 1.0.0-alpha.3 → 1.0.0-alpha.31
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 +278 -0
- package/LICENSE.md +200 -591
- 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-pPPsJB9N.js +1 -0
- package/dist/packem_shared/{fix-dts-default-cjs-exports-BQc0nwIG.mjs → fix-dts-default-cjs-exports-EvsobpME.js} +3 -3
- 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-CZ4v3hr9.js +6 -0
- package/dist/packem_shared/resolveTsconfigPathsPlugin-CEasmDpi.js +1 -0
- package/dist/packem_shared/{resolveTsconfigRootDirectoriesPlugin-_93afm2q.mjs → resolveTsconfigRootDirectoriesPlugin-Cwj3tqCJ.js} +1 -1
- package/dist/plugins/babel/index.d.ts +10 -0
- package/dist/plugins/babel/index.js +1 -0
- 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 +135 -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 +112 -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/patchTypescriptTypes-BEdkvKxL.mjs +0 -6
- 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/{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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { FilterPattern } from "@rollup/pluginutils";
|
|
2
|
+
import type { Plugin } from "rollup";
|
|
3
|
+
export interface UrlOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The destination dir to copy assets, usually used to rebase the assets according to HTML files.
|
|
6
|
+
* @type {string}
|
|
7
|
+
*/
|
|
8
|
+
destDir?: string;
|
|
9
|
+
/**
|
|
10
|
+
* If false, will prevent files being emitted by this plugin. This is useful for when you are using Rollup to emit both a client-side and server-side bundle.
|
|
11
|
+
* @type {boolean}
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
emitFiles: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
|
|
17
|
+
* should _ignore_.
|
|
18
|
+
*
|
|
19
|
+
* By default, no files are ignored.
|
|
20
|
+
* @type {FilterPattern}
|
|
21
|
+
*/
|
|
22
|
+
exclude?: FilterPattern;
|
|
23
|
+
/**
|
|
24
|
+
* If emitFiles is true, this option can be used to rename the emitted files. It accepts the following string replacements:
|
|
25
|
+
* [hash] - The hash value of the file's contents
|
|
26
|
+
* [name] - The name of the imported file (without its file extension)
|
|
27
|
+
* [extname] - The extension of the imported file (including the leading .)
|
|
28
|
+
* [dirname] - The parent directory name of the imported file (including trailing /)
|
|
29
|
+
* @type {string}
|
|
30
|
+
* @default [hash][extname]
|
|
31
|
+
*/
|
|
32
|
+
fileName: string;
|
|
33
|
+
/**
|
|
34
|
+
* A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
|
|
35
|
+
* should operate on.
|
|
36
|
+
* By default, the png,jpg,jpeg,gif,svg,webp files are targeted.
|
|
37
|
+
* @type {FilterPattern}
|
|
38
|
+
*/
|
|
39
|
+
include?: FilterPattern;
|
|
40
|
+
/**
|
|
41
|
+
* The file size limit for inline files.
|
|
42
|
+
* If a file exceeds this limit, it will be copied to the destination folder and the hashed filename will be provided instead.
|
|
43
|
+
* If limit is set to 0 all files will be copied.
|
|
44
|
+
* @type {number}
|
|
45
|
+
* @default 14336 (14kb)
|
|
46
|
+
*/
|
|
47
|
+
limit: number;
|
|
48
|
+
/**
|
|
49
|
+
* A string which will be added in front of filenames when they are not inlined but are copied.
|
|
50
|
+
* @type {string}
|
|
51
|
+
*/
|
|
52
|
+
publicPath?: string;
|
|
53
|
+
/**
|
|
54
|
+
* When using the [dirname] replacement in fileName, use this directory as the source directory from which to create the file path rather than the parent directory of the imported file. For example:
|
|
55
|
+
* @example
|
|
56
|
+
* ```js
|
|
57
|
+
* src/path/to/file.js
|
|
58
|
+
*
|
|
59
|
+
* import png from './image.d.ts';
|
|
60
|
+
* rollup.config.js
|
|
61
|
+
*
|
|
62
|
+
* url({
|
|
63
|
+
* fileName: '[dirname][hash][extname]',
|
|
64
|
+
* sourceDir: path.join(__dirname, 'src')
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* Emitted File: path/to/image.png
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
sourceDir?: string;
|
|
71
|
+
}
|
|
72
|
+
export declare const urlPlugin: ({ destDir: destinationDirectory, emitFiles, exclude, fileName, include, limit, publicPath, sourceDir: sourceDirectory, }: UrlOptions) => Plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var A=Object.defineProperty;var w=(t,a)=>A(t,"name",{value:a,configurable:!0});import D from"node:crypto";import{createReadStream as S,createWriteStream as j}from"node:fs";import{stat as k,readFile as E}from"node:fs/promises";import{createFilter as O}from"@rollup/pluginutils";import{ensureDir as y}from"@visulima/fs";import{extname as R,basename as P,relative as W,dirname as c,join as u}from"@visulima/path";import{R as z}from"../packem_shared/index-QEzU3Fey.js";import{svgEncoder as B}from"@visulima/packem-share/utils";var C=Object.defineProperty,b=w((t,a)=>C(t,"name",{value:a,configurable:!0}),"g");const H=b(async(t,a)=>{await new Promise((p,m)=>{const s=S(t);s.on("error",m);const i=j(a);i.on("error",m),i.on("finish",()=>p(void 0)),s.pipe(i)})},"copy"),M=b(({destDir:t,emitFiles:a,exclude:p,fileName:m,include:s,limit:i,publicPath:x,sourceDir:f})=>{const F=O(s,p),d={};return{async generateBundle(e){if(!a)return;const l=t??e.dir??c(e.file??"");await y(l),await Promise.all(Object.keys(d).map(async n=>{const r=d[n],o=u(l,c(r));await y(o),await H(n,u(l,r))}))},async load(e){if(!F(e))return;this.addWatchFile(e);const[l,n]=await Promise.all([k(e),E(e)]);let r;if(i&&l.size>i||i===0){const o=D.createHash("sha1").update(n).digest("hex").slice(0,16),g=R(e),$=P(e,g),h=f?W(f,c(e)):P(c(e)),v=m.replaceAll("[hash]",o).replaceAll("[extname]",g).replaceAll("[dirname]",h===""?"":`${h}/`).replaceAll("[name]",$);r=u(x??"",v),d[e]=v}else{const o=z.getType(e);if(o===void 0)throw new Error(`Could not determine mimetype for ${e}`);r=o==="image/svg+xml"?B(n):n.toString("base64"),r=`data:${o};base64,${r}`}return`export default "${r}"`},name:"packem:url"}},"urlPlugin");export{M as urlPlugin};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
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 { BabelPluginConfig } from "./plugins/babel/index.d.ts";
|
|
14
|
+
import type { CJSInteropOptions } from "./plugins/cjs-interop.d.ts";
|
|
15
|
+
import type { CopyPluginOptions } from "./plugins/copy.d.ts";
|
|
16
|
+
import type { DataUriPluginOptions } from "./plugins/data-uri.d.ts";
|
|
17
|
+
import type { DebarrelPluginOptions } from "./plugins/debarrel.d.ts";
|
|
18
|
+
import type { EsbuildPluginConfig, Options as EsbuildOptions } from "./plugins/esbuild/types.d.ts";
|
|
19
|
+
import type { EsmShimCjsSyntaxOptions } from "./plugins/esm-shim-cjs-syntax.d.ts";
|
|
20
|
+
import type { IsolatedDeclarationsOptions } from "./plugins/isolated-declarations/index.d.ts";
|
|
21
|
+
import type { JSXRemoveAttributesPlugin } from "./plugins/jsx-remove-attributes.d.ts";
|
|
22
|
+
import type { LicenseOptions } from "./plugins/license.d.ts";
|
|
23
|
+
import type { MinifyHTMLLiteralsOptions } from "./plugins/minify-html-literals/index.d.ts";
|
|
24
|
+
import type { NativeModulesOptions } from "./plugins/native-modules-plugin.d.ts";
|
|
25
|
+
import type { InternalOXCTransformPluginConfig, OxcResolveOptions, OXCTransformPluginConfig } from "./plugins/oxc/types.d.ts";
|
|
26
|
+
import type { RawLoaderOptions } from "./plugins/raw.d.ts";
|
|
27
|
+
import type { Options as RequireCJSPluginOptions } from "./plugins/require-cjs-transformer.d.ts";
|
|
28
|
+
import type { ShebangOptions } from "./plugins/shebang.d.ts";
|
|
29
|
+
import type { SourcemapsPluginOptions } from "./plugins/source-maps.d.ts";
|
|
30
|
+
import type { SucrasePluginConfig } from "./plugins/sucrase/index.d.ts";
|
|
31
|
+
import type { SwcPluginConfig } from "./plugins/swc/types.d.ts";
|
|
32
|
+
import type { PatchTypesOptions } from "./plugins/typescript/patch-typescript-types.d.ts";
|
|
33
|
+
import type { TsconfigPathsPluginOptions } from "./plugins/typescript/resolve-tsconfig-paths-plugin.d.ts";
|
|
34
|
+
import type { UrlOptions } from "./plugins/url.d.ts";
|
|
35
|
+
interface RollupDynamicImportVariablesOptions {
|
|
36
|
+
/**
|
|
37
|
+
* By default, the plugin will not throw errors when target files are not found.
|
|
38
|
+
* Setting this option to true will result in errors thrown when encountering files which don't exist.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
errorWhenNoFilesFound?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
|
|
44
|
+
* should _ignore_.
|
|
45
|
+
*
|
|
46
|
+
* By default, no files are ignored.
|
|
47
|
+
*/
|
|
48
|
+
exclude?: FilterPattern;
|
|
49
|
+
/**
|
|
50
|
+
* A picomatch pattern, or array of patterns, which specifies the files in the build the plugin
|
|
51
|
+
* should operate on.
|
|
52
|
+
* By default, all files are targeted.
|
|
53
|
+
*/
|
|
54
|
+
include?: FilterPattern;
|
|
55
|
+
/**
|
|
56
|
+
* By default, the plugin quits the build process when it encounters an error.
|
|
57
|
+
* If you set this option to true, it will throw a warning instead and leave the code untouched.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
warnOnError?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ExtendedRollupNodeResolveOptions extends RollupNodeResolveOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Controls how unresolved import warnings from the node-resolve plugin are handled.
|
|
65
|
+
* - `"error"` (default): Treat unresolved imports as errors, causing the build to fail
|
|
66
|
+
* - `"warn"`: Treat unresolved imports as warnings, allowing the build to continue
|
|
67
|
+
* @default "error"
|
|
68
|
+
*/
|
|
69
|
+
unresolvedImportBehavior?: "error" | "warn";
|
|
70
|
+
}
|
|
71
|
+
export interface IsolatedDeclarationsResult {
|
|
72
|
+
errors: string[];
|
|
73
|
+
map?: string;
|
|
74
|
+
sourceText: string;
|
|
75
|
+
}
|
|
76
|
+
export type IsolatedDeclarationsTransformer = (code: string, id: string, sourceMap?: boolean) => Promise<IsolatedDeclarationsResult>;
|
|
77
|
+
export interface PackemRollupOptions {
|
|
78
|
+
alias?: RollupAliasOptions | false;
|
|
79
|
+
babel?: BabelPluginConfig | false;
|
|
80
|
+
cjsInterop?: CJSInteropOptions;
|
|
81
|
+
commonjs?: RollupCommonJSOptions | false;
|
|
82
|
+
copy?: CopyPluginOptions | false;
|
|
83
|
+
dataUri?: DataUriPluginOptions | false;
|
|
84
|
+
debarrel?: DebarrelPluginOptions | false;
|
|
85
|
+
dts?: RollupDtsOptions;
|
|
86
|
+
dynamicVars?: RollupDynamicImportVariablesOptions | false;
|
|
87
|
+
esbuild?: EsbuildOptions | false;
|
|
88
|
+
experimental?: {
|
|
89
|
+
resolve?: OxcResolveOptions | false;
|
|
90
|
+
};
|
|
91
|
+
isolatedDeclarations?: IsolatedDeclarationsOptions;
|
|
92
|
+
json?: RollupJsonOptions | false;
|
|
93
|
+
jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
|
|
94
|
+
license?: LicenseOptions | false;
|
|
95
|
+
metafile?: boolean;
|
|
96
|
+
minifyHTMLLiterals?: MinifyHTMLLiteralsOptions | false;
|
|
97
|
+
nativeModules?: NativeModulesOptions | false;
|
|
98
|
+
output?: OutputOptions;
|
|
99
|
+
oxc?: Omit<OXCTransformPluginConfig, "cwd" | "sourcemap" | "target"> | false;
|
|
100
|
+
patchTypes?: PatchTypesOptions | false;
|
|
101
|
+
pluginPure?: Omit<PureAnnotationsOptions, "sourcemap"> | false;
|
|
102
|
+
plugins?: RollupPlugins;
|
|
103
|
+
polyfillNode?: NodePolyfillsOptions | false;
|
|
104
|
+
preserveDirectives?: {
|
|
105
|
+
directiveRegex?: RegExp;
|
|
106
|
+
exclude?: FilterPattern;
|
|
107
|
+
include?: FilterPattern;
|
|
108
|
+
};
|
|
109
|
+
preserveDynamicImports?: boolean;
|
|
110
|
+
raw?: RawLoaderOptions | false;
|
|
111
|
+
replace?: Omit<RollupReplaceOptions, "cwd"> | false;
|
|
112
|
+
requireCJS?: RequireCJSPluginOptions | false;
|
|
113
|
+
resolve?: ExtendedRollupNodeResolveOptions | false;
|
|
114
|
+
shebang?: Partial<ShebangOptions> | false;
|
|
115
|
+
shim?: EsmShimCjsSyntaxOptions | false;
|
|
116
|
+
sourcemap?: SourcemapsPluginOptions;
|
|
117
|
+
sucrase?: SucrasePluginConfig | false;
|
|
118
|
+
swc?: SwcPluginConfig | false;
|
|
119
|
+
treeshake?: RollupOptions["treeshake"];
|
|
120
|
+
tsconfigPaths?: TsconfigPathsPluginOptions | false;
|
|
121
|
+
url?: UrlOptions | false;
|
|
122
|
+
visualizer?: PluginVisualizerOptions | false;
|
|
123
|
+
wasm?: RollupWasmOptions | false;
|
|
124
|
+
watch?: RollupOptions["watch"];
|
|
125
|
+
}
|
|
126
|
+
export type RollupPlugins = {
|
|
127
|
+
enforce?: "post" | "pre";
|
|
128
|
+
plugin: Plugin;
|
|
129
|
+
type?: "build" | "dts";
|
|
130
|
+
}[];
|
|
131
|
+
export type TransformerFn = ((config: EsbuildPluginConfig | InternalOXCTransformPluginConfig | SucrasePluginConfig | SwcPluginConfig) => Plugin) & {
|
|
132
|
+
NAME?: TransformerName;
|
|
133
|
+
};
|
|
134
|
+
export type TransformerName = "esbuild" | "oxc" | "sucrase" | "swc";
|
|
135
|
+
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.31",
|
|
4
4
|
"description": "Rollup plugins for packem",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -34,28 +34,104 @@
|
|
|
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
|
+
},
|
|
40
|
+
"./babel": {
|
|
41
|
+
"types": "./dist/plugins/babel/index.d.ts",
|
|
42
|
+
"default": "./dist/plugins/babel/index.js"
|
|
39
43
|
},
|
|
40
44
|
"./esbuild": {
|
|
41
|
-
"types": "./dist/plugins/esbuild/index.d.
|
|
42
|
-
"default": "./dist/plugins/esbuild/index.
|
|
45
|
+
"types": "./dist/plugins/esbuild/index.d.ts",
|
|
46
|
+
"default": "./dist/plugins/esbuild/index.js"
|
|
43
47
|
},
|
|
44
48
|
"./swc": {
|
|
45
|
-
"types": "./dist/plugins/swc/index.d.
|
|
46
|
-
"default": "./dist/plugins/swc/index.
|
|
49
|
+
"types": "./dist/plugins/swc/index.d.ts",
|
|
50
|
+
"default": "./dist/plugins/swc/index.js"
|
|
47
51
|
},
|
|
48
52
|
"./typescript": {
|
|
49
|
-
"types": "./dist/plugins/typescript/index.d.
|
|
50
|
-
"default": "./dist/plugins/typescript/index.
|
|
53
|
+
"types": "./dist/plugins/typescript/index.d.ts",
|
|
54
|
+
"default": "./dist/plugins/typescript/index.js"
|
|
51
55
|
},
|
|
52
56
|
"./oxc": {
|
|
53
|
-
"types": "./dist/plugins/oxc/index.d.
|
|
54
|
-
"default": "./dist/plugins/oxc/index.
|
|
57
|
+
"types": "./dist/plugins/oxc/index.d.ts",
|
|
58
|
+
"default": "./dist/plugins/oxc/index.js"
|
|
55
59
|
},
|
|
56
60
|
"./sucrase": {
|
|
57
|
-
"types": "./dist/plugins/sucrase/index.d.
|
|
58
|
-
"default": "./dist/plugins/sucrase/index.
|
|
61
|
+
"types": "./dist/plugins/sucrase/index.d.ts",
|
|
62
|
+
"default": "./dist/plugins/sucrase/index.js"
|
|
63
|
+
},
|
|
64
|
+
"./plugin/minify-html-literals": {
|
|
65
|
+
"types": "./dist/plugins/minify-html-literals/index.d.ts",
|
|
66
|
+
"default": "./dist/plugins/minify-html-literals/index.js"
|
|
67
|
+
},
|
|
68
|
+
"./plugin/require-cjs-transformer": {
|
|
69
|
+
"types": "./dist/plugins/require-cjs-transformer.d.ts",
|
|
70
|
+
"default": "./dist/plugins/require-cjs-transformer.js"
|
|
71
|
+
},
|
|
72
|
+
"./plugin/cjs-interop": {
|
|
73
|
+
"types": "./dist/plugins/cjs-interop.d.ts",
|
|
74
|
+
"default": "./dist/plugins/cjs-interop.js"
|
|
75
|
+
},
|
|
76
|
+
"./plugin/copy": {
|
|
77
|
+
"types": "./dist/plugins/copy.d.ts",
|
|
78
|
+
"default": "./dist/plugins/copy.js"
|
|
79
|
+
},
|
|
80
|
+
"./plugin/data-uri": {
|
|
81
|
+
"types": "./dist/plugins/data-uri.d.ts",
|
|
82
|
+
"default": "./dist/plugins/data-uri.js"
|
|
83
|
+
},
|
|
84
|
+
"./plugin/debarrel": {
|
|
85
|
+
"types": "./dist/plugins/debarrel.d.ts",
|
|
86
|
+
"default": "./dist/plugins/debarrel.js"
|
|
87
|
+
},
|
|
88
|
+
"./plugin/esm-shim-cjs-syntax": {
|
|
89
|
+
"types": "./dist/plugins/esm-shim-cjs-syntax.d.ts",
|
|
90
|
+
"default": "./dist/plugins/esm-shim-cjs-syntax.js"
|
|
91
|
+
},
|
|
92
|
+
"./plugin/fix-dts-default-cjs-exports": {
|
|
93
|
+
"types": "./dist/plugins/fix-dts-default-cjs-exports.d.ts",
|
|
94
|
+
"default": "./dist/plugins/fix-dts-default-cjs-exports.js"
|
|
95
|
+
},
|
|
96
|
+
"./plugin/isolated-declarations": {
|
|
97
|
+
"types": "./dist/plugins/isolated-declarations/index.d.ts",
|
|
98
|
+
"default": "./dist/plugins/isolated-declarations/index.js"
|
|
99
|
+
},
|
|
100
|
+
"./plugin/jsx-remove-attributes": {
|
|
101
|
+
"types": "./dist/plugins/jsx-remove-attributes.d.ts",
|
|
102
|
+
"default": "./dist/plugins/jsx-remove-attributes.js"
|
|
103
|
+
},
|
|
104
|
+
"./plugin/license": {
|
|
105
|
+
"types": "./dist/plugins/license.d.ts",
|
|
106
|
+
"default": "./dist/plugins/license.js"
|
|
107
|
+
},
|
|
108
|
+
"./plugin/native-modules": {
|
|
109
|
+
"types": "./dist/plugins/native-modules-plugin.d.ts",
|
|
110
|
+
"default": "./dist/plugins/native-modules-plugin.js"
|
|
111
|
+
},
|
|
112
|
+
"./plugin/preserve-directives": {
|
|
113
|
+
"types": "./dist/plugins/preserve-directives.d.ts",
|
|
114
|
+
"default": "./dist/plugins/preserve-directives.js"
|
|
115
|
+
},
|
|
116
|
+
"./plugin/raw": {
|
|
117
|
+
"types": "./dist/plugins/raw.d.ts",
|
|
118
|
+
"default": "./dist/plugins/raw.js"
|
|
119
|
+
},
|
|
120
|
+
"./plugin/shebang": {
|
|
121
|
+
"types": "./dist/plugins/shebang.d.ts",
|
|
122
|
+
"default": "./dist/plugins/shebang.js"
|
|
123
|
+
},
|
|
124
|
+
"./plugin/source-maps": {
|
|
125
|
+
"types": "./dist/plugins/source-maps.d.ts",
|
|
126
|
+
"default": "./dist/plugins/source-maps.js"
|
|
127
|
+
},
|
|
128
|
+
"./plugin/url": {
|
|
129
|
+
"types": "./dist/plugins/url.d.ts",
|
|
130
|
+
"default": "./dist/plugins/url.js"
|
|
131
|
+
},
|
|
132
|
+
"./plugin/json": {
|
|
133
|
+
"types": "./dist/plugins/json.d.ts",
|
|
134
|
+
"default": "./dist/plugins/json.js"
|
|
59
135
|
},
|
|
60
136
|
"./package.json": "./package.json"
|
|
61
137
|
},
|
|
@@ -65,37 +141,41 @@
|
|
|
65
141
|
"dist"
|
|
66
142
|
],
|
|
67
143
|
"dependencies": {
|
|
68
|
-
"@babel/parser": "7.28.
|
|
144
|
+
"@babel/parser": "7.28.4",
|
|
69
145
|
"@rollup/plugin-alias": "5.1.1",
|
|
70
|
-
"@rollup/plugin-commonjs": "
|
|
146
|
+
"@rollup/plugin-commonjs": "29.0.0",
|
|
71
147
|
"@rollup/plugin-dynamic-import-vars": "2.1.5",
|
|
72
148
|
"@rollup/plugin-inject": "5.0.5",
|
|
73
149
|
"@rollup/plugin-json": "6.1.0",
|
|
74
150
|
"@rollup/plugin-node-resolve": "16.0.1",
|
|
75
151
|
"@rollup/plugin-replace": "6.0.2",
|
|
76
152
|
"@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.
|
|
153
|
+
"@rollup/pluginutils": "5.3.0",
|
|
154
|
+
"@visulima/find-cache-dir": "2.0.4",
|
|
155
|
+
"@visulima/fs": "4.0.4",
|
|
156
|
+
"@visulima/package": "4.1.4",
|
|
157
|
+
"@visulima/packem-share": "1.0.0-alpha.15",
|
|
82
158
|
"@visulima/path": "1.4.0",
|
|
83
|
-
"@visulima/source-map": "
|
|
84
|
-
"
|
|
159
|
+
"@visulima/source-map": "2.0.3",
|
|
160
|
+
"cjs-module-lexer": "^2.1.1",
|
|
161
|
+
"clean-css": "^5.3.3",
|
|
85
162
|
"glob-parent": "6.0.2",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"oxc-
|
|
90
|
-
"
|
|
163
|
+
"html-minifier-next": "^4.7.0",
|
|
164
|
+
"magic-string": "0.30.19",
|
|
165
|
+
"mlly": "1.8.0",
|
|
166
|
+
"oxc-parser": "0.99.0",
|
|
167
|
+
"oxc-resolver": "11.14.0",
|
|
168
|
+
"rollup-plugin-dts": "6.2.3",
|
|
91
169
|
"rollup-plugin-license": "3.6.0",
|
|
92
170
|
"rollup-plugin-polyfill-node": "0.13.0",
|
|
93
171
|
"rollup-plugin-pure": "^0.4.0",
|
|
94
172
|
"rollup-plugin-visualizer": "6.0.3",
|
|
173
|
+
"rs-module-lexer": "^2.6.0",
|
|
95
174
|
"semver": "7.7.2",
|
|
96
|
-
"tinyglobby": "0.2.
|
|
175
|
+
"tinyglobby": "0.2.15"
|
|
97
176
|
},
|
|
98
177
|
"peerDependencies": {
|
|
178
|
+
"@babel/core": "*",
|
|
99
179
|
"@swc/core": "*",
|
|
100
180
|
"esbuild": "*",
|
|
101
181
|
"oxc-transform": "*",
|
|
@@ -104,6 +184,9 @@
|
|
|
104
184
|
"typescript": "*"
|
|
105
185
|
},
|
|
106
186
|
"peerDependenciesMeta": {
|
|
187
|
+
"@babel/core": {
|
|
188
|
+
"optional": true
|
|
189
|
+
},
|
|
107
190
|
"@swc/core": {
|
|
108
191
|
"optional": true
|
|
109
192
|
},
|
|
@@ -124,7 +207,7 @@
|
|
|
124
207
|
}
|
|
125
208
|
},
|
|
126
209
|
"engines": {
|
|
127
|
-
"node": ">=
|
|
210
|
+
"node": ">=20.19.* <=25.*"
|
|
128
211
|
},
|
|
129
212
|
"publishConfig": {
|
|
130
213
|
"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};
|