@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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ported from https://github.com/lit/lit/tree/main/packages/labs/rollup-plugin-minify-html-literals
|
|
3
|
+
*
|
|
4
|
+
* BSD-3-Clause License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2024 Google LLC
|
|
7
|
+
*/
|
|
8
|
+
export interface Template {
|
|
9
|
+
parts: TemplatePart[];
|
|
10
|
+
tag?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TemplatePart {
|
|
13
|
+
end: number;
|
|
14
|
+
start: number;
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Strategy<N = unknown> {
|
|
18
|
+
getRootNode: (source: string, fileName?: string) => N;
|
|
19
|
+
getTaggedTemplateTemplate: (node: N) => unknown;
|
|
20
|
+
getTagText: (node: N) => string;
|
|
21
|
+
getTemplateParts: (node: N) => TemplatePart[];
|
|
22
|
+
isTaggedTemplate: (node: N) => boolean;
|
|
23
|
+
isTemplate: (node: N) => boolean;
|
|
24
|
+
walkNodes: (parent: N, visit: (child: N) => void) => void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ported from https://github.com/lit/lit/tree/main/packages/labs/rollup-plugin-minify-html-literals
|
|
3
|
+
*
|
|
4
|
+
* BSD-3-Clause License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2024 Google LLC
|
|
7
|
+
*/
|
|
8
|
+
import type { Strategy, Template } from "./models.d.ts";
|
|
9
|
+
export interface ParseLiteralsOptions {
|
|
10
|
+
fileName?: string;
|
|
11
|
+
strategy?: Partial<Strategy<unknown>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const parseLiterals: (source: string, options?: ParseLiteralsOptions) => Template[];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import CleanCSS from "clean-css";
|
|
2
|
+
import type { MinifierOptions as HTMLOptions } from "html-minifier-next";
|
|
3
|
+
import type { TemplatePart } from "./models.d.ts";
|
|
4
|
+
/**
|
|
5
|
+
* A strategy on how to minify HTML and optionally CSS.
|
|
6
|
+
* @template O minify HTML options
|
|
7
|
+
* @template C minify CSS options
|
|
8
|
+
*/
|
|
9
|
+
export interface Strategy<O = unknown, C = unknown> {
|
|
10
|
+
/**
|
|
11
|
+
* Combines the parts' HTML text strings together into a single string using
|
|
12
|
+
* the provided placeholder. The placeholder indicates where a template
|
|
13
|
+
* expression occurs.
|
|
14
|
+
* @param parts the parts to combine
|
|
15
|
+
* @param placeholder the placeholder to use between parts
|
|
16
|
+
* @returns the combined parts' text strings
|
|
17
|
+
*/
|
|
18
|
+
combineHTMLStrings: (parts: TemplatePart[], placeholder: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Retrieve a placeholder for the given array of template parts. The
|
|
21
|
+
* placeholder returned should be the same if the function is invoked with the
|
|
22
|
+
* same array of parts.
|
|
23
|
+
*
|
|
24
|
+
* The placeholder should be an HTML-compliant string that is not present in
|
|
25
|
+
* any of the parts' text.
|
|
26
|
+
* @param parts the parts to get a placeholder for
|
|
27
|
+
* @returns the placeholder
|
|
28
|
+
*/
|
|
29
|
+
getPlaceholder: (parts: TemplatePart[]) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Minifies the provided CSS string.
|
|
32
|
+
* @param css the css to minfiy
|
|
33
|
+
* @param options css minify options
|
|
34
|
+
* @returns minified CSS string
|
|
35
|
+
*/
|
|
36
|
+
minifyCSS?: (css: string, options?: C) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Minfies the provided HTML string.
|
|
39
|
+
* @param html the html to minify
|
|
40
|
+
* @param options html minify options
|
|
41
|
+
* @returns minified HTML string
|
|
42
|
+
*/
|
|
43
|
+
minifyHTML: (html: string, options?: O) => string | Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Splits a minfied HTML string back into an array of strings from the
|
|
46
|
+
* provided placeholder. The returned array of strings should be the same
|
|
47
|
+
* length as the template parts that were combined to make the HTML string.
|
|
48
|
+
* @param html the html string to split
|
|
49
|
+
* @param placeholder the placeholder to split by
|
|
50
|
+
* @returns an array of html strings
|
|
51
|
+
*/
|
|
52
|
+
splitHTMLByPlaceholder: (html: string, placeholder: string) => string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The default <code>clean-css</code> options, optimized for production
|
|
56
|
+
* minification.
|
|
57
|
+
*/
|
|
58
|
+
export declare const defaultMinifyCSSOptions: CleanCSS.Options;
|
|
59
|
+
/**
|
|
60
|
+
* The default <code>html-minifier</code> options, optimized for production
|
|
61
|
+
* minification.
|
|
62
|
+
*/
|
|
63
|
+
export declare const defaultMinifyOptions: HTMLOptions;
|
|
64
|
+
export declare const adjustMinifyCSSOptions: (options?: CleanCSS.Options) => CleanCSS.Options;
|
|
65
|
+
/**
|
|
66
|
+
* The default strategy. This uses <code>html-minifier</code> to minify HTML and
|
|
67
|
+
* <code>clean-css</code> to minify CSS.
|
|
68
|
+
*/
|
|
69
|
+
export declare const defaultStrategy: Strategy<HTMLOptions, CleanCSS.Options>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ported from https://github.com/lit/lit/tree/main/packages/labs/rollup-plugin-minify-html-literals
|
|
3
|
+
*
|
|
4
|
+
* BSD-3-Clause License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2024 Google LLC
|
|
7
|
+
*/
|
|
8
|
+
import ts from "typescript";
|
|
9
|
+
import type { TemplatePart } from "./models.d.ts";
|
|
10
|
+
export interface TypescriptStrategy {
|
|
11
|
+
getHeadTemplatePart: (node: ts.TemplateLiteral | ts.TemplateHead) => TemplatePart;
|
|
12
|
+
getMiddleTailTemplatePart: (node: ts.TemplateMiddle | ts.TemplateTail) => TemplatePart;
|
|
13
|
+
getRootNode: (source: string, fileName?: string) => ts.SourceFile;
|
|
14
|
+
getTaggedTemplateTemplate: (node: ts.TaggedTemplateExpression) => ts.TemplateLiteral;
|
|
15
|
+
getTagText: (node: ts.TaggedTemplateExpression) => string;
|
|
16
|
+
getTemplateParts: (node: ts.TemplateLiteral) => TemplatePart[];
|
|
17
|
+
isTaggedTemplate: (node: ts.Node) => node is ts.TaggedTemplateExpression;
|
|
18
|
+
isTemplate: (node: ts.Node) => node is ts.TemplateLiteral;
|
|
19
|
+
walkChildNodes: (node: ts.Node, visit: (node: ts.Node) => void) => void;
|
|
20
|
+
walkNodes: (root: ts.SourceFile, visit: (node: ts.Node) => void) => void;
|
|
21
|
+
}
|
|
22
|
+
declare const _default: TypescriptStrategy;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Plugin } from "rollup";
|
|
2
|
+
export interface NativeModulesOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Custom subdirectory name for native modules within the output directory
|
|
5
|
+
* @default 'natives'
|
|
6
|
+
*/
|
|
7
|
+
nativesDirectory?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Handles native Node.js addons (.node files)
|
|
11
|
+
* - Stage 1 (resolve/load): Identifies .node files and generates runtime code.
|
|
12
|
+
* - Stage 2 (generateBundle): Copies the identified .node files to the output dir.
|
|
13
|
+
*/
|
|
14
|
+
export declare const nativeModulesPlugin: (config?: NativeModulesOptions) => Plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.defineProperty;var m=(s,o)=>h(s,"name",{value:o,configurable:!0});import{copyFile as w}from"node:fs/promises";import{isAccessible as A,ensureDir as P}from"@visulima/fs";import{resolve as v,dirname as c,basename as f,extname as b,join as g}from"@visulima/path";var x=Object.defineProperty,y=m((s,o)=>x(s,"name",{value:o,configurable:!0}),"c");const d="\0natives:",B=y((s={})=>{const{nativesDirectory:o="natives"}=s,a=new Map;let n;return{buildStart(){a.clear()},generateBundle:y(async r=>{if(!n){const e=Array.isArray(r)?r[0]:r;e&&e.dir?n=e.dir:e&&e.file&&(n=c(e.file))}if(a.size===0)return;if(!n){(void 0).error("Output directory not detected. Please ensure Rollup output options are configured.");return}const t=g(n,o);await P(t),await Promise.all([...a.entries()].map(([e,i])=>{const u=g(t,i);return w(e,u)}))},"generateBundle"),load(r){if(!r.startsWith(d))return;const t=r.slice(d.length),e=a.get(t);if(e||this.error(`Could not find staged native module for: ${t}`),!n){const i=this;if(i&&i.meta&&i.meta.rollupVersion)return`export default require("./${o}/${e}");`;this.error("Output directory not detected. Please ensure Rollup output options are configured.")}return`export default require("${`./${o}/${e}`.replaceAll("\\","/")}");`},name:"native-modules",options(r){const t=r;if(t.output){const e=Array.isArray(t.output)?t.output[0]:t.output;e.dir?n=e.dir:e.file&&(n=c(e.file))}return r},resolveId:{filter:{id:/\.node$/},async handler(r,t){if(r.startsWith(d))return;const e=t?v(c(t),r):v(r);if(!await A(e)){this.warn(`Native module not found: ${e}`);return}const i=f(e);let u=i,p=1;const $=new Set([...a.values()].map(l=>f(l)));for(;$.has(u);){const l=b(i);u=`${f(i,l)}_${p}${l}`,p+=1}return a.set(e,u),d+e}}}},"nativeModulesPlugin");export{B as nativeModulesPlugin};
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '@rollup/plugin-alias';
|
|
6
|
-
import '@rollup/plugin-commonjs';
|
|
7
|
-
import '@rollup/plugin-json';
|
|
8
|
-
import '@rollup/plugin-node-resolve';
|
|
9
|
-
import '@rollup/plugin-replace';
|
|
10
|
-
import '@rollup/plugin-wasm';
|
|
11
|
-
import '@rollup/pluginutils';
|
|
12
|
-
import 'rollup-plugin-dts';
|
|
13
|
-
import 'rollup-plugin-polyfill-node';
|
|
14
|
-
import 'rollup-plugin-pure';
|
|
15
|
-
import 'rollup-plugin-visualizer';
|
|
16
|
-
import 'esbuild';
|
|
17
|
-
import '@visulima/package';
|
|
18
|
-
import '@visulima/packem-share/types';
|
|
19
|
-
import 'oxc-resolver';
|
|
20
|
-
import 'sucrase';
|
|
21
|
-
|
|
22
|
-
declare const oxcResolvePlugin: (options: OxcResolveOptions, rootDirectory: string, logger: PailServerType, tsconfigPath?: string) => Plugin;
|
|
23
|
-
|
|
24
|
-
declare const oxcTransformPlugin: TransformerFn;
|
|
25
|
-
|
|
26
|
-
declare const isolatedDeclarationsOxcTransformer: (id: string, code: string, sourceMap?: boolean, transformOptions?: Omit<IsolatedDeclarationsOptions, "sourcemap">) => IsolatedDeclarationsResult;
|
|
27
|
-
|
|
28
|
-
export { OxcResolveOptions, isolatedDeclarationsOxcTransformer, oxcResolvePlugin, oxcTransformPlugin };
|
|
1
|
+
export { default as isolatedDeclarationsOxcTransformer } from "./isolated-declarations-oxc-transformer.d.ts";
|
|
2
|
+
export { default as oxcResolvePlugin } from "./oxc-resolve-plugin.d.ts";
|
|
3
|
+
export { default as oxcTransformPlugin } from "./oxc-transformer-plugin.d.ts";
|
|
4
|
+
export type * from "./types.d.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as a}from"../../packem_shared/isolatedDeclarationsOxcTransformer-WbfE6cGu.js";import{default as f}from"../../packem_shared/oxcResolvePlugin-Ccef6pyL.js";import{default as s}from"../../packem_shared/oxcTransformPlugin-DfVQouIB.js";export{a as isolatedDeclarationsOxcTransformer,f as oxcResolvePlugin,s as oxcTransformPlugin};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IsolatedDeclarationsOptions } from "oxc-transform";
|
|
2
|
+
import type { IsolatedDeclarationsResult } from "../../types.d.ts";
|
|
3
|
+
declare const isolatedDeclarationsOxcTransformer: (id: string, code: string, sourceMap?: boolean, transformOptions?: Omit<IsolatedDeclarationsOptions, "sourcemap">) => IsolatedDeclarationsResult;
|
|
4
|
+
export default isolatedDeclarationsOxcTransformer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FilterPattern } from "@rollup/pluginutils";
|
|
2
|
+
import type { NapiResolveOptions } from "oxc-resolver";
|
|
3
|
+
import type { JsxOptions, TransformOptions } from "oxc-transform";
|
|
4
|
+
export type InternalOXCTransformPluginConfig = TransformOptions & {
|
|
5
|
+
exclude?: FilterPattern;
|
|
6
|
+
include?: FilterPattern;
|
|
7
|
+
};
|
|
8
|
+
export type OXCTransformPluginConfig = Omit<TransformOptions, "cwd" | "sourcemap" | "target" | "typescript"> & {
|
|
9
|
+
exclude?: FilterPattern;
|
|
10
|
+
include?: FilterPattern;
|
|
11
|
+
/** Configure how TSX and JSX are transformed. */
|
|
12
|
+
jsx?: Omit<JsxOptions, "refresh"> | "preserve";
|
|
13
|
+
};
|
|
14
|
+
export type OxcResolveOptions = Omit<NapiResolveOptions, "tsconfig"> & {
|
|
15
|
+
ignoreSideEffectsForRoot?: boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/huozhi/rollup-preserve-directives/blob/main/src/index.ts
|
|
3
|
+
*
|
|
4
|
+
* The MIT License (MIT)
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2018 these people -> https://github.com/huozhi/rollup-preserve-directives/graphs/contributors
|
|
7
|
+
*/
|
|
8
|
+
import type { FilterPattern } from "@rollup/pluginutils";
|
|
9
|
+
import type { Plugin } from "rollup";
|
|
10
|
+
export type PreserveDirectivesPluginOptions = {
|
|
11
|
+
directiveRegex: RegExp;
|
|
12
|
+
exclude?: FilterPattern;
|
|
13
|
+
include?: FilterPattern;
|
|
14
|
+
logger: Console;
|
|
15
|
+
};
|
|
16
|
+
export declare const preserveDirectivesPlugin: ({ directiveRegex, exclude, include, logger }: PreserveDirectivesPluginOptions) => Plugin;
|
package/dist/{packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs → plugins/preserve-directives.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var b=Object.defineProperty;var v=(a
|
|
1
|
+
var b=Object.defineProperty;var v=(d,a)=>b(d,"name",{value:a,configurable:!0});import{createFilter as x}from"@rollup/pluginutils";import g from"magic-string";var y=Object.defineProperty,$=v((d,a)=>y(d,"name",{value:a,configurable:!0}),"l");const S=$(({directiveRegex:d,exclude:a=[],include:m=[],logger:p})=>{const u={},l={},h=x(m,a);return{name:"packem:preserve-directives",onLog(i,t){if(t.code==="MODULE_LEVEL_DIRECTIVE"&&i==="warn")return!1},renderChunk:{handler(i,t,{sourcemap:c}){const s=t.moduleIds.map(r=>{if(u[r])return u[r]}).reduce((r,f)=>(f&&f.forEach(o=>{r.add(o)}),r),new Set),n=new g(i);s.size>0&&(p.debug({message:`directives for chunk "${t.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),n.prepend(`${[...s].map(r=>`'${r}';`).join(`
|
|
2
2
|
`)}
|
|
3
|
-
`));let e;if(t.facadeModuleId&&typeof
|
|
4
|
-
`)),!(s.size===0&&e===void 0))return{code:n.toString(),map:c?n.generateMap({hires:!0}):void 0}},order:"post"},transform(i,t){if(!h(t))return;let c=!1;const s=new g(i);if(i.startsWith("#")&&i[1]==="!"){let e=0;for(let r=2,
|
|
3
|
+
`));let e;if(t.facadeModuleId&&typeof l[t.facadeModuleId]=="string"&&(e=l[t.facadeModuleId]),e&&(p.debug({message:`shebang for chunk "${t.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),n.prepend(`${e}
|
|
4
|
+
`)),!(s.size===0&&e===void 0))return{code:n.toString(),map:c?n.generateMap({hires:!0}):void 0}},order:"post"},transform(i,t){if(!h(t))return;let c=!1;const s=new g(i);if(i.startsWith("#")&&i[1]==="!"){let e=0;for(let r=2,f=i.length;r<f;r++){const o=i.codePointAt(r);if(o===10||o===13||o===8232||o===8233){e=r;break}}e&&(l[t]=i.slice(0,e),s.remove(0,e+1),c=!0,p.debug({message:`shebang for module "${t}" is preserved.`,prefix:"plugin:preserve-directives"}))}let n;try{n=this.parse(s.toString(),{allowReturnOutsideFunction:!0})}catch(e){this.warn({code:"PARSE_ERROR",message:`failed to parse "${t}" and extract the directives.`}),p.warn(e);return}if(n.type==="Program"){for(const e of n.body.filter(Boolean)){if(e.type!=="ExpressionStatement")break;let r;"directive"in e?r=e.directive:e.expression.type==="Literal"&&typeof e.expression.value=="string"&&d.test(e.expression.value)&&(r=e.expression.value),r!=="use strict"&&r&&(u[t]||=new Set,u[t].add(r),"start"in e&&typeof e.start=="number"&&"end"in e&&typeof e.end=="number"&&(s.remove(e.start,e.end),c=!0),p.debug({message:`directive "${r}" for module "${t}" is preserved.`,prefix:"plugin:preserve-directives"}))}if(c)return{code:s.toString(),map:s.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...u[t]??[]],shebang:l[t]??void 0}}}}}}},"preserveDirectivesPlugin");export{S as preserveDirectivesPlugin};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var i=Object.defineProperty;var n=(r,a)=>i(r,"name",{value:a,configurable:!0});import{createFilter as s}from"@rollup/pluginutils";import{readFile as u}from"@visulima/fs";var p=Object.defineProperty,d=n((r,a)=>p(r,"name",{value:a,configurable:!0}),"a");const g=d(r=>{const a=s(r.include,r.exclude);return{async load(t){if(t.includes("?raw")){const e=t.split("?")[0];try{const l=await u(e);return process.platform==="win32"?l.replaceAll(`\r
|
|
2
|
+
`,`
|
|
3
|
+
`):l}catch{this.error(`Failed to read file: ${e}`)}}return null},name:"packem:raw",transform(t,e){const l=e.includes("?raw"),o=l?e.split("?")[0]:e;if(a(o)||l){const c=process.platform==="win32"?t.replaceAll(`\r
|
|
4
|
+
`,`
|
|
5
|
+
`):t;return{code:`const data = ${JSON.stringify(c)};
|
|
6
|
+
export default data;`,map:null}}return null}}},"rawPlugin");export{g as rawPlugin};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { FilterPattern } from "@rollup/pluginutils";
|
|
2
|
+
import type { Plugin, ResolvedId } from "rollup";
|
|
3
|
+
type Awaitable<T> = T | Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* @returns A boolean or a promise that resolves to a boolean,
|
|
6
|
+
* or `undefined` to let the plugin decide automatically.
|
|
7
|
+
*/
|
|
8
|
+
export type TransformFunction = (
|
|
9
|
+
/**
|
|
10
|
+
* The module ID (path) being imported.
|
|
11
|
+
*/
|
|
12
|
+
id: string,
|
|
13
|
+
/**
|
|
14
|
+
* The module ID (path) of the importer.
|
|
15
|
+
*/
|
|
16
|
+
importer: string,
|
|
17
|
+
/**
|
|
18
|
+
* Rollup resolve function for better module resolution
|
|
19
|
+
*/
|
|
20
|
+
rollupResolve: (id: string, importer?: string) => Promise<ResolvedId | null>) => Awaitable<boolean | undefined | void>;
|
|
21
|
+
export interface Options {
|
|
22
|
+
/**
|
|
23
|
+
* Whether to transform Node.js built-in modules (e.g., `fs`, `path`)
|
|
24
|
+
* to `process.getBuiltinModule()` calls when supported, which has the best performance.
|
|
25
|
+
* Falls back to `createRequire()` for older Node.js versions, Bun, and Deno.
|
|
26
|
+
*
|
|
27
|
+
* Note: `process.getBuiltinModule` is available since Node.js 20.16.0 and 22.3.0.
|
|
28
|
+
* For older versions, the plugin uses `createRequire()` as fallback.
|
|
29
|
+
*/
|
|
30
|
+
builtinNodeModules?: boolean;
|
|
31
|
+
cwd?: string;
|
|
32
|
+
exclude?: FilterPattern;
|
|
33
|
+
include?: FilterPattern;
|
|
34
|
+
order?: "pre" | "post" | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* A function to determine whether a module should be transformed.
|
|
37
|
+
* Return `true` to force transformation, `false` to skip transformation,
|
|
38
|
+
* or `undefined` to let the plugin decide automatically.
|
|
39
|
+
*/
|
|
40
|
+
shouldTransform?: string[] | TransformFunction;
|
|
41
|
+
}
|
|
42
|
+
export declare const requireCJSTransformerPlugin: (userOptions: Options, _logger: Console) => Plugin;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var E=Object.defineProperty;var w=(e,r)=>E(e,"name",{value:r,configurable:!0});import{createRequire as F,builtinModules as K}from"node:module";import B from"node:process";import{createFilter as L}from"@rollup/pluginutils";import{init as x,parse as G}from"cjs-module-lexer";import S from"magic-string";import{parseSync as H}from"oxc-parser";import{readFile as Q}from"@visulima/fs";import{findPackageJson as U}from"@visulima/package/package-json";var V=Object.defineProperty,X=w((e,r)=>V(e,"name",{value:r,configurable:!0}),"s");const Y=X(async(e,r,i)=>{if(await x(),e.startsWith("node:"))return!1;if(e.endsWith(".cjs"))return!0;if(e.endsWith(".js")||!e.includes("/")&&!e.startsWith(".")){let s;if(i)try{s=(await i(e,r)).id}catch{}if(!s&&r&&!r.includes("!~{"))try{s=F(r).resolve(e)}catch{}if(s){try{const{packageJson:o}=await U(s);if(o.type==="module")return!1;if(o.type==="commonjs")return!0}catch{}try{const o=await Q(s,{encoding:"utf8"});try{return G(o,s),!0}catch{}}catch{}}}return!1},"isPureCJS");var Z=Object.defineProperty,m=w((e,r)=>Z(e,"name",{value:r,configurable:!0}),"c");const T="__cjs_require",z='import { createRequire as __cjs_createRequire } from "node:module";',ee=`const ${T} = __cjs_createRequire(import.meta.url);`,re='const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;',se=`const __cjs_getBuiltinModule = (module) => {
|
|
2
|
+
// Check if we're in Node.js and version supports getBuiltinModule
|
|
3
|
+
if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
|
|
4
|
+
const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
|
|
5
|
+
// Node.js 20.16.0+ and 22.3.0+
|
|
6
|
+
if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
|
|
7
|
+
return __cjs_getProcess.getBuiltinModule(module);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
// Fallback to createRequire
|
|
11
|
+
return ${T}(module);
|
|
12
|
+
};`,g={builtin:/const\s+__cjs_getBuiltinModule\s*=\s*\(module\)\s*=>\s*\{[\s\S]*?\};\s*/g,import:/import\s*\{\s*createRequire(?:\s+as\s+__cjs_createRequire)?\s*\}\s*from\s*["']node:module["'];?\s*/g,process:/const\s+__cjs_getProcess\s*=\s*typeof\s+globalThis[^;]*;\s*/g,require:/const\s+__cjs_require\s*=\s*(?:__cjs_)?createRequire\s*\([^)]*\);\s*/g};let R=!1;const te=m((e,r)=>r&&(K.includes(e)||e.startsWith("node:")),"isBuiltinModule"),oe=m(async(e,r,i,s,o)=>{if(r)return!0;const c=await i?.(e,s,o);return c===void 0?await Y(e,s,o):c},"shouldTransformImport"),ne=m((e,r)=>r?e==="process"||e==="node:process"?{code:"__cjs_getProcess",needsBuiltin:!1,needsProcess:!0,needsRequire:!0}:{code:`__cjs_getBuiltinModule(${JSON.stringify(e)})`,needsBuiltin:!0,needsProcess:!0,needsRequire:!0}:{code:`${T}(${JSON.stringify(e)})`,needsBuiltin:!1,needsProcess:!1,needsRequire:!0},"generateRequireCode"),ie=m(e=>{const r=new S(e),i={builtin:[...e.matchAll(g.builtin)],import:[...e.matchAll(g.import)],process:[...e.matchAll(g.process)],require:[...e.matchAll(g.require)]};return Object.values(i).forEach(s=>{if(s.length>1)for(let o=s.length-1;o>0;o-=1){const c=s[o];c&&r.remove(c.index,c.index+c[0].length)}}),r.toString()},"removeDuplicates"),ce=m(e=>{if(Array.isArray(e.shouldTransform)){const{shouldTransform:r}=e;e.shouldTransform=i=>r.includes(i)}return{builtinNodeModules:!!e.builtinNodeModules,cwd:e.cwd||B.cwd(),exclude:e.exclude||[/node_modules/,/\.d\.[cm]?ts$/],include:e.include||[/\.[cm]?[jt]sx?$/],order:"order"in e?e.order:"pre",shouldTransform:e.shouldTransform}},"resolveOptions"),he=m((e,r)=>{if(B.env.INTERNAL_PACKEM_BUILD)return{name:"require-cjs-transformer"};const{builtinNodeModules:i,cwd:s,exclude:o,include:c,order:A,shouldTransform:C}=ce(e),J=L(c,o);return{async buildStart(){R||(await x(),R=!0)},name:"packem:plugin-require-cjs",renderChunk:{async handler(h,M,O){if(O.format!=="es"||!J(M.fileName))return;const I=H(M.fileName,h,{astType:"js",lang:"js",sourceType:"module"}),u=new S(h);let j=!1,y=!1,v=!1;for await(const t of I.program.body){if(t.type!=="ImportDeclaration"||t.importKind==="type")continue;const l=t.source.value,d=te(l,i),$=this.resolve;if(!await oe(l,d,C,s,$))continue;const{code:b,needsBuiltin:k,needsProcess:W,needsRequire:D}=ne(l,d);if(j||=D,y||=W,v||=k,t.specifiers.length===0){d?u.remove(t.start,t.end):u.overwrite(t.start,t.end,`${b};`);continue}const P=[];let f,a;for(const n of t.specifiers)if(n.type==="ImportNamespaceSpecifier")f=n.local.name;else if(n.type==="ImportSpecifier"&&n.importKind!=="type"){const _=h.slice(n.imported.start,n.imported.end);P.push([_,n.local.name])}else n.type==="ImportDefaultSpecifier"&&(a=n.local.name);const p=[];if(f&&(a||=`_cjs_${f}_default`),a&&p.push(`const ${a} = ${b};`),f&&p.push(`const ${f} = { ...${a}, default: ${a} };`),P.length>0){const n=`const {
|
|
13
|
+
${P.map(([_,q])=>` ${_===q?q:`${_}: ${q}`}`).join(`,
|
|
14
|
+
`)}
|
|
15
|
+
} = ${a||b};`;p.push(n)}u.overwrite(t.start,t.end,p.join(`
|
|
16
|
+
`))}if(j||y||v){const t=[];j&&t.push(z,ee),y&&t.push(re),v&&t.push(se);const l=`${t.join(`
|
|
17
|
+
|
|
18
|
+
`)}
|
|
19
|
+
|
|
20
|
+
`,d=u.toString();if(d[0]==="#"){const $=d.indexOf(`
|
|
21
|
+
`)+1;u.appendLeft($,l)}else u.prepend(l)}const N=new S(ie(u.toString()));return{code:N.toString(),map:N.generateMap()}},order:A}}},"requireCJSTransformerPlugin");export{he as requireCJSTransformerPlugin};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Plugin } from "rollup";
|
|
2
|
+
export type ShebangOptions = {
|
|
3
|
+
replace: boolean;
|
|
4
|
+
shebang: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const makeExecutable: (filePath: string) => Promise<void>;
|
|
7
|
+
export declare const shebangPlugin: (executablePaths: string[], options: ShebangOptions) => Plugin;
|
|
8
|
+
export declare const removeShebangPlugin: () => Plugin;
|
|
9
|
+
export declare const getShebang: (code: string, append?: string) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FilterPattern } from "@rollup/pluginutils";
|
|
2
|
+
import type { Plugin } from "rollup";
|
|
3
|
+
export interface SourcemapsPluginOptions {
|
|
4
|
+
exclude?: FilterPattern;
|
|
5
|
+
include?: FilterPattern;
|
|
6
|
+
}
|
|
7
|
+
export declare const sourcemapsPlugin: ({ exclude, include }?: SourcemapsPluginOptions) => Plugin;
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import '@rollup/plugin-wasm';
|
|
10
|
-
import 'rollup';
|
|
11
|
-
import 'rollup-plugin-dts';
|
|
12
|
-
import 'rollup-plugin-polyfill-node';
|
|
13
|
-
import 'rollup-plugin-pure';
|
|
14
|
-
import 'rollup-plugin-visualizer';
|
|
15
|
-
import 'esbuild';
|
|
16
|
-
import '@visulima/package';
|
|
17
|
-
import '@visulima/packem-share/types';
|
|
18
|
-
import 'oxc-resolver';
|
|
19
|
-
import 'oxc-transform';
|
|
1
|
+
import type { FilterPattern } from "@rollup/pluginutils";
|
|
2
|
+
import type { Options } from "sucrase";
|
|
3
|
+
import type { TransformerFn as TransformerFunction } from "../../types.d.ts";
|
|
4
|
+
export interface SucrasePluginConfig extends Options {
|
|
5
|
+
exclude?: FilterPattern;
|
|
6
|
+
include?: FilterPattern;
|
|
7
|
+
}
|
|
8
|
+
export declare const sucrasePlugin: TransformerFunction;
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
import '@rollup/plugin-commonjs';
|
|
5
|
-
import '@rollup/plugin-json';
|
|
6
|
-
import '@rollup/plugin-node-resolve';
|
|
7
|
-
import '@rollup/plugin-replace';
|
|
8
|
-
import '@rollup/plugin-wasm';
|
|
9
|
-
import '@rollup/pluginutils';
|
|
10
|
-
import 'rollup';
|
|
11
|
-
import 'rollup-plugin-dts';
|
|
12
|
-
import 'rollup-plugin-polyfill-node';
|
|
13
|
-
import 'rollup-plugin-pure';
|
|
14
|
-
import 'rollup-plugin-visualizer';
|
|
15
|
-
import 'esbuild';
|
|
16
|
-
import '@visulima/package';
|
|
17
|
-
import '@visulima/packem-share/types';
|
|
18
|
-
import 'oxc-resolver';
|
|
19
|
-
import 'oxc-transform';
|
|
20
|
-
import 'sucrase';
|
|
21
|
-
|
|
22
|
-
declare const _default: TransformerFn;
|
|
23
|
-
|
|
24
|
-
declare const isolatedDeclarationsSwcTransformer: (id: string, code: string, sourceMap?: boolean) => Promise<IsolatedDeclarationsResult>;
|
|
25
|
-
|
|
26
|
-
export { isolatedDeclarationsSwcTransformer, _default as swcPlugin };
|
|
1
|
+
export { default as isolatedDeclarationsSwcTransformer } from "./isolated-declarations-swc-transformer.d.ts";
|
|
2
|
+
export { default as swcPlugin } from "./swc-plugin.d.ts";
|
|
3
|
+
export type * from "./types.d.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as e}from"../../packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC.js";import{default as s}from"../../packem_shared/swcPlugin-Boip4lWG.js";export{e as isolatedDeclarationsSwcTransformer,s as swcPlugin};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FilterPattern } from "@rollup/pluginutils";
|
|
2
|
+
import type { Options } from "@swc/types";
|
|
3
|
+
export type SwcPluginConfig = Exclude<Options, "configFile" | "exclude" | "filename" | "sourceMaps" | "swcrc"> & {
|
|
4
|
+
exclude?: FilterPattern;
|
|
5
|
+
include?: FilterPattern;
|
|
6
|
+
};
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import '@rollup/plugin-replace';
|
|
10
|
-
import '@rollup/plugin-wasm';
|
|
11
|
-
import '@rollup/pluginutils';
|
|
12
|
-
import 'rollup-plugin-dts';
|
|
13
|
-
import 'rollup-plugin-polyfill-node';
|
|
14
|
-
import 'rollup-plugin-pure';
|
|
15
|
-
import 'rollup-plugin-visualizer';
|
|
16
|
-
import 'esbuild';
|
|
17
|
-
import '@visulima/package';
|
|
18
|
-
import '@visulima/packem-share/types';
|
|
19
|
-
import 'oxc-resolver';
|
|
20
|
-
import 'oxc-transform';
|
|
21
|
-
import 'sucrase';
|
|
22
|
-
|
|
23
|
-
declare const isolatedDeclarationsTypescriptTransformer: (id: string, code: string, sourceMap?: boolean, transformOptions?: TranspileOptions) => Promise<IsolatedDeclarationsResult>;
|
|
24
|
-
|
|
25
|
-
declare const resolveTsconfigRootDirectories: (cwd: string, logger: PailServerType, tsconfig: TsConfigResult) => Plugin;
|
|
26
|
-
|
|
27
|
-
declare const resolveTypescriptMjsCts: () => Plugin;
|
|
28
|
-
|
|
29
|
-
export { isolatedDeclarationsTypescriptTransformer, resolveTsconfigRootDirectories as resolveTsconfigRootDirectoriesPlugin, resolveTypescriptMjsCts as resolveTypescriptMjsCtsPlugin };
|
|
1
|
+
export { default as isolatedDeclarationsTypescriptTransformer } from "./isolated-declarations-typescript-transformer.d.ts";
|
|
2
|
+
export type { PatchTypesOptions } from "./patch-typescript-types.d.ts";
|
|
3
|
+
export { patchTypescriptTypes } from "./patch-typescript-types.d.ts";
|
|
4
|
+
export { patchTypescriptTypes as patchTypescriptTypesPlugin } from "./patch-typescript-types.d.ts";
|
|
5
|
+
export type { TsconfigPathsPluginOptions } from "./resolve-tsconfig-paths-plugin.d.ts";
|
|
6
|
+
export { resolveTsconfigPathsPlugin } from "./resolve-tsconfig-paths-plugin.d.ts";
|
|
7
|
+
export { default as resolveTsconfigRootDirectoriesPlugin } from "./resolve-tsconfig-root-dirs.d.ts";
|
|
8
|
+
export { default as resolveTypescriptMjsCtsPlugin } from "./resolve-typescript-mjs-cjs.d.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{default as s}from"../../packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo.js";import{patchTypescriptTypes as o,patchTypescriptTypes as p}from"../../packem_shared/patchTypescriptTypes-CZ4v3hr9.js";import{resolveTsconfigPathsPlugin as i}from"../../packem_shared/resolveTsconfigPathsPlugin-CEasmDpi.js";import{default as l}from"../../packem_shared/resolveTsconfigRootDirectoriesPlugin-Cwj3tqCJ.js";import{default as T}from"../../packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM.js";export{s as isolatedDeclarationsTypescriptTransformer,o as patchTypescriptTypes,p as patchTypescriptTypesPlugin,i as resolveTsconfigPathsPlugin,l as resolveTsconfigRootDirectoriesPlugin,T as resolveTypescriptMjsCtsPlugin};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TranspileOptions } from "typescript";
|
|
2
|
+
import type { IsolatedDeclarationsResult } from "../../types.d.ts";
|
|
3
|
+
declare const isolatedDeclarationsTypescriptTransformer: (id: string, code: string, sourceMap?: boolean, transformOptions?: TranspileOptions) => Promise<IsolatedDeclarationsResult>;
|
|
4
|
+
export default isolatedDeclarationsTypescriptTransformer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Plugin } from "rollup";
|
|
2
|
+
export type PatchTypesOptions = {
|
|
3
|
+
identifierReplacements?: Record<string, Record<string, string>>;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Patch the types files before passing to dts plugin
|
|
7
|
+
*
|
|
8
|
+
* 1. Validate unallowed dependency imports
|
|
9
|
+
* 2. Replace confusing type names
|
|
10
|
+
* 3. Strip leftover internal types
|
|
11
|
+
* 4. Clean unnecessary comments
|
|
12
|
+
*/
|
|
13
|
+
export declare const patchTypescriptTypes: (options: PatchTypesOptions, logger: Console) => Plugin;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TsConfigResult } from "@visulima/tsconfig";
|
|
2
|
+
import type { Plugin } from "rollup";
|
|
3
|
+
export type TsconfigPathsPluginOptions = {
|
|
4
|
+
resolveAbsolutePath?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Handles tsconfig.json or jsconfig.js "paths" option for webpack
|
|
8
|
+
* Largely based on how the TypeScript compiler handles it:
|
|
9
|
+
* https://github.com/microsoft/TypeScript/blob/1a9c8197fffe3dace5f8dca6633d450a88cba66d/src/compiler/moduleNameResolver.ts#L1362
|
|
10
|
+
*/
|
|
11
|
+
export declare const resolveTsconfigPathsPlugin: (rootDirectory: string, tsconfig: TsConfigResult, logger: Console, pluginOptions: TsconfigPathsPluginOptions) => Plugin;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TsConfigResult } from "@visulima/tsconfig";
|
|
2
|
+
import type { Plugin } from "rollup";
|
|
3
|
+
/**
|
|
4
|
+
* This plugin resolves module paths using the rootDirs configuration from the tsconfig.json file.
|
|
5
|
+
*
|
|
6
|
+
* Consider the following example configuration:
|
|
7
|
+
* @example
|
|
8
|
+
* ```json
|
|
9
|
+
* {
|
|
10
|
+
* "compilerOptions": {
|
|
11
|
+
* "rootDirs": ["lib"]
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* This configuration will allow you to import modules from the `src` and `lib` directories.
|
|
17
|
+
*
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { foo } from "./foo.d.ts"; -> ./src/foo
|
|
20
|
+
* import { bar } from "./bar.d.ts"; // -> ./lib/bar
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const resolveTsconfigRootDirectories: (cwd: string, logger: Console, tsconfig: TsConfigResult) => Plugin;
|
|
24
|
+
export default resolveTsconfigRootDirectories;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modified copy of https://github.com/privatenumber/pkgroll/blob/develop/src/utils/rollup-plugins/resolve-typescript-mjs-cjs.ts
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
|
|
7
|
+
*/
|
|
8
|
+
import type { Plugin } from "rollup";
|
|
9
|
+
declare const resolveTypescriptMjsCts: () => Plugin;
|
|
10
|
+
export default resolveTypescriptMjsCts;
|