@visulima/packem-rollup 1.0.0-alpha.26 → 1.0.0-alpha.28

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE.md +228 -183
  3. package/dist/index.d.ts +24 -58
  4. package/dist/plugins/cache-plugin.d.ts +11 -0
  5. package/dist/plugins/chunk-splitter/gather.d.ts +8 -0
  6. package/dist/plugins/chunk-splitter/index.d.ts +6 -0
  7. package/dist/plugins/chunk-splitter/parse/index.d.ts +4 -0
  8. package/dist/plugins/chunk-splitter/parse/types.d.ts +24 -0
  9. package/dist/plugins/cjs-interop.d.ts +3 -7
  10. package/dist/plugins/copy.d.ts +12 -7
  11. package/dist/plugins/data-uri.d.ts +21 -8
  12. package/dist/plugins/debarrel.d.ts +4 -8
  13. package/dist/{packem_shared/browserslist-to-esbuild-DY9HwYtp.d.ts → plugins/esbuild/browserslist-to-esbuild.d.ts} +1 -2
  14. package/dist/plugins/esbuild/esbuild-plugin.d.ts +3 -0
  15. package/dist/plugins/esbuild/index.d.ts +3 -42
  16. package/dist/plugins/esbuild/types.d.ts +39 -0
  17. package/dist/plugins/esbuild/utils/get-render-chunk.d.ts +14 -0
  18. package/dist/plugins/esbuild/utils/optimize-deps.d.ts +3 -0
  19. package/dist/plugins/esbuild/utils/warn.d.ts +4 -0
  20. package/dist/plugins/esm-shim-cjs-syntax.d.ts +6 -10
  21. package/dist/plugins/fix-dts-default-cjs-exports.d.ts +24 -7
  22. package/dist/plugins/fix-dynamic-import-extension.d.ts +3 -0
  23. package/dist/plugins/isolated-declarations/index.d.ts +5 -10
  24. package/dist/plugins/isolated-declarations/index.js +2 -2
  25. package/dist/plugins/isolated-declarations/utils/extend-string.d.ts +2 -0
  26. package/dist/plugins/isolated-declarations/utils/fix-dts-default-cjs-exports.d.ts +35 -0
  27. package/dist/plugins/isolated-declarations/utils/lowest-common-ancestor.d.ts +2 -0
  28. package/dist/plugins/isolated-declarations/utils/split-tsconfig-path-key.d.ts +2 -0
  29. package/dist/plugins/json.d.ts +4 -7
  30. package/dist/plugins/json.js +1 -1
  31. package/dist/plugins/jsx-remove-attributes.d.ts +3 -7
  32. package/dist/plugins/jsx-remove-attributes.js +1 -1
  33. package/dist/plugins/license.d.ts +3 -7
  34. package/dist/plugins/metafile.d.ts +3 -0
  35. package/dist/plugins/minify-html-literals/index.d.ts +36 -91
  36. package/dist/plugins/minify-html-literals/index.js +2 -2
  37. package/dist/plugins/minify-html-literals/lib/minify-html-literals.d.ts +200 -0
  38. package/dist/plugins/minify-html-literals/lib/models.d.ts +25 -0
  39. package/dist/plugins/minify-html-literals/lib/parse-literals.d.ts +13 -0
  40. package/dist/plugins/minify-html-literals/lib/strategy.d.ts +69 -0
  41. package/dist/plugins/minify-html-literals/lib/typescript.d.ts +23 -0
  42. package/dist/plugins/native-modules-plugin.d.ts +12 -7
  43. package/dist/plugins/native-modules-plugin.js +1 -1
  44. package/dist/plugins/oxc/index.d.ts +4 -45
  45. package/dist/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +4 -0
  46. package/dist/plugins/oxc/oxc-resolve-plugin.d.ts +4 -0
  47. package/dist/plugins/oxc/oxc-transformer-plugin.d.ts +3 -0
  48. package/dist/plugins/oxc/types.d.ts +16 -0
  49. package/dist/plugins/preserve-directives.d.ts +11 -8
  50. package/dist/plugins/raw.d.ts +4 -8
  51. package/dist/plugins/require-cjs-transformer.d.ts +35 -9
  52. package/dist/plugins/resolve-file-url.d.ts +3 -0
  53. package/dist/plugins/shebang.d.ts +6 -10
  54. package/dist/plugins/source-maps.d.ts +4 -8
  55. package/dist/plugins/sucrase/index.d.ts +8 -36
  56. package/dist/plugins/swc/index.d.ts +3 -43
  57. package/dist/plugins/swc/isolated-declarations-swc-transformer.d.ts +3 -0
  58. package/dist/plugins/swc/swc-plugin.d.ts +3 -0
  59. package/dist/plugins/swc/types.d.ts +6 -0
  60. package/dist/plugins/typescript/index.d.ts +8 -46
  61. package/dist/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +4 -0
  62. package/dist/plugins/typescript/patch-typescript-types.d.ts +13 -0
  63. package/dist/plugins/typescript/resolve-tsconfig-paths-plugin.d.ts +11 -0
  64. package/dist/plugins/typescript/resolve-tsconfig-root-dirs.d.ts +24 -0
  65. package/dist/plugins/typescript/resolve-typescript-mjs-cjs.d.ts +10 -0
  66. package/dist/plugins/url.d.ts +63 -8
  67. package/dist/types.d.ts +133 -0
  68. package/dist/utils/chunks/create-split-chunks.d.ts +11 -0
  69. package/dist/utils/chunks/get-custom-module-layer.d.ts +2 -0
  70. package/dist/utils/chunks/get-module-layer.d.ts +10 -0
  71. package/dist/utils/index.d.ts +4 -0
  72. package/dist/utils/is-pure-cjs.d.ts +9 -0
  73. package/package.json +10 -10
  74. package/dist/packem_shared/types-BiZanzz1.d.ts +0 -4226
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "rollup";
2
+ declare const metafilePlugin: () => Plugin;
3
+ export default metafilePlugin;
@@ -1,96 +1,41 @@
1
- import { FilterPattern } from '@rollup/pluginutils';
2
- import { Plugin } from 'rollup';
3
- import { SourceMapOptions } from 'magic-string';
4
- import { MinifierOptions } from 'html-minifier-next';
5
-
6
- interface Template {
7
- parts: TemplatePart[];
8
- tag?: string;
9
- }
10
- interface TemplatePart {
11
- end: number;
12
- start: number;
13
- text: string;
14
- }
15
- interface Strategy$1<N = unknown> {
16
- getRootNode: (source: string, fileName?: string) => N;
17
- getTaggedTemplateTemplate: (node: N) => unknown;
18
- getTagText: (node: N) => string;
19
- getTemplateParts: (node: N) => TemplatePart[];
20
- isTaggedTemplate: (node: N) => boolean;
21
- isTemplate: (node: N) => boolean;
22
- walkNodes: (parent: N, visit: (child: N) => void) => void;
23
- }
24
-
25
- interface ParseLiteralsOptions {
26
- fileName?: string;
27
- strategy?: Partial<Strategy$1<unknown>>;
28
- }
29
- declare const parseLiterals: (source: string, options?: ParseLiteralsOptions) => Template[];
30
-
31
- interface Strategy<O = unknown, C = unknown> {
32
- combineHTMLStrings: (parts: TemplatePart[], placeholder: string) => string;
33
- getPlaceholder: (parts: TemplatePart[]) => string;
34
- minifyCSS?: (css: string, options?: C) => string;
35
- minifyHTML: (html: string, options?: O) => string | Promise<string>;
36
- splitHTMLByPlaceholder: (html: string, placeholder: string) => string[];
37
- }
38
- declare const defaultMinifyOptions: MinifierOptions;
39
-
40
- type Options = DefaultOptions | CustomOptions<unknown>;
41
- interface DefaultOptions extends BaseOptions {
42
- minifyOptions?: Partial<typeof defaultMinifyOptions>;
43
- }
44
- interface CustomOptions<S extends Strategy | unknown> extends BaseOptions {
45
- minifyOptions?: S extends Strategy<infer O> ? Partial<O> : never;
46
- strategy: S;
47
- }
48
- interface BaseOptions {
49
- fileName?: string;
50
- generateSourceMap?: ((ms: MagicStringLike, fileName: string) => SourceMap | undefined) | false;
51
- MagicString?: new (source: string) => MagicStringLike;
52
- parseLiterals?: typeof parseLiterals;
53
- parseLiteralsOptions?: Partial<ParseLiteralsOptions>;
54
- shouldMinify?: (template: Template) => boolean;
55
- shouldMinifyCSS?: (template: Template) => boolean;
56
- validate?: Validation | false;
57
- }
58
- interface MagicStringLike {
59
- generateMap: (options?: Partial<SourceMapOptions>) => SourceMap;
60
- overwrite: (start: number, end: number, content: string) => unknown;
61
- toString: () => string;
62
- }
63
- interface SourceMap {
64
- file?: string;
65
- mappings: string;
66
- names: string[];
67
- sources: string[];
68
- sourcesContent?: string[];
69
- toString: () => string;
70
- toUrl: () => string;
71
- version: number;
72
- }
73
- interface Validation {
74
- ensureHTMLPartsValid: (parts: TemplatePart[], htmlParts: string[]) => void;
75
- ensurePlaceholderValid: (placeholder: unknown) => void;
76
- }
77
- interface Result {
78
- code: string;
79
- map: SourceMap | undefined;
80
- }
81
- declare function minifyHTMLLiterals(source: string, options?: DefaultOptions): Promise<Result | null>;
82
- declare function minifyHTMLLiterals<S extends Strategy>(source: string, options?: CustomOptions<S>): Promise<Result | null>;
83
-
84
- interface MinifyHTMLLiteralsOptions {
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 { FilterPattern } from "@rollup/pluginutils";
9
+ import type { Plugin } from "rollup";
10
+ import * as minify from "./lib/minify-html-literals.d.ts";
11
+ /**
12
+ * Plugin options.
13
+ */
14
+ export interface MinifyHTMLLiteralsOptions {
15
+ /**
16
+ * Pattern or array of patterns of files not to minify.
17
+ */
85
18
  exclude?: FilterPattern;
19
+ /**
20
+ * If true, any errors while parsing or minifying will abort the bundle
21
+ * process. Defaults to false, which will only show a warning.
22
+ */
86
23
  failOnError?: boolean;
24
+ /**
25
+ * Pattern or array of patterns of files to minify.
26
+ */
87
27
  include?: FilterPattern;
88
- minifyHTMLLiterals?: typeof minifyHTMLLiterals;
89
- options?: Partial<Options>;
90
- }
91
- declare const minifyHTMLLiteralsPlugin: ({ exclude, failOnError, include, logger, minifyHTMLLiterals, options, }: MinifyHTMLLiteralsOptions & {
28
+ /**
29
+ * Override minify-html-literals function.
30
+ */
31
+ minifyHTMLLiterals?: typeof minify.minifyHTMLLiterals;
32
+ /**
33
+ * Minify options, see
34
+ * https://www.npmjs.com/package/minify-html-literals#options.
35
+ */
36
+ options?: Partial<minify.Options>;
37
+ }
38
+ export declare const minifyHTMLLiteralsPlugin: ({ exclude, failOnError, include, logger, minifyHTMLLiterals, options, }: MinifyHTMLLiteralsOptions & {
92
39
  logger: Console;
93
40
  }) => Plugin;
94
-
95
- export { minifyHTMLLiteralsPlugin as default, minifyHTMLLiteralsPlugin };
96
- export type { MinifyHTMLLiteralsOptions };
41
+ export default minifyHTMLLiteralsPlugin;
@@ -1,3 +1,3 @@
1
- var b=Object.defineProperty;var g=(t,e)=>b(t,"name",{value:e,configurable:!0});import{createFilter as E}from"@rollup/pluginutils";import H from"magic-string";import p from"typescript";import N from"clean-css";import{minify as j}from"html-minifier-next";let y;const A={getHeadTemplatePart(t){const e=t.getFullText(y),i=e.indexOf("`")+1,r=p.isTemplateHead(t)?-2:-1;return{end:t.end+r,start:t.pos+i,text:e.slice(i,e.length+r)}},getMiddleTailTemplatePart(t){const e=t.getText(y),i=p.isTemplateMiddle(t)?2:1;return{end:t.end-i,start:t.getStart(y)+1,text:e.slice(1,e.length-i)}},getRootNode(t,e=""){return p.createSourceFile(e,t,p.ScriptTarget.ESNext)},getTaggedTemplateTemplate(t){return t.template},getTagText(t){return t.tag.getText(y)},getTemplateParts(t){return p.isNoSubstitutionTemplateLiteral(t)?[this.getHeadTemplatePart(t)]:[this.getHeadTemplatePart(t.head),...t.templateSpans.map(e=>this.getMiddleTailTemplatePart(e.literal))]},isTaggedTemplate:p.isTaggedTemplateExpression,isTemplate:p.isTemplateLiteral,walkChildNodes(t,e){e(t),p.forEachChild(t,i=>{this.walkChildNodes(i,e)})},walkNodes(t,e){y=t,this.walkChildNodes(t,e),y=void 0}};var k=Object.defineProperty,V=g((t,e)=>k(t,"name",{value:e,configurable:!0}),"i");const W=V((t,e={})=>{const i={...A,...e.strategy},r=[],s=[];return i.walkNodes(i.getRootNode(t,e.fileName),n=>{if(i.isTaggedTemplate(n)){const a=i.getTaggedTemplateTemplate(n);s.push(a),r.push({parts:i.getTemplateParts(a),tag:i.getTagText(n)})}else i.isTemplate(n)&&!s.includes(n)&&r.push({parts:i.getTemplateParts(n)})}),r},"parseLiterals");var $=Object.defineProperty,C=g((t,e)=>$(t,"name",{value:e,configurable:!0}),"f");const S={One:"1",Two:"2",Zero:"0"},F=C(t=>{const e={[S.One]:{tidySelectors:!1,transform:void 0},[S.Two]:{tidySelectors:!1,transform:void 0},[S.Zero]:{}};if(t===void 0)return e;if(typeof t=="number"){const i=t.toString();return{...e,[i]:{...e[i]}}}return t},"optimizationLevelFrom"),R={},B={caseSensitive:!0,collapseWhitespace:!0,decodeEntities:!0,minifyCSS:R,minifyJS:!0,processConditionalComments:!0,removeAttributeQuotes:!1,removeComments:!0,removeEmptyAttributes:!0,removeScriptTypeAttributes:!0,removeStyleLinkTypeAttributes:!0,useShortDoctype:!0},_={combineHTMLStrings(t,e){return t.map(i=>i.text).join(e)},getPlaceholder(t){let e="@TEMPLATE_EXPRESSION";for(;t.some(i=>i.text.includes(e+"();"));)e+="_";return e+"();"},minifyCSS(t,e={}){const i=P(e),r=new N(i).minify(t);if(r.errors&&r.errors.length>0)throw new Error(r.errors.join(`
1
+ var b=Object.defineProperty;var g=(t,e)=>b(t,"name",{value:e,configurable:!0});import{createFilter as E}from"@rollup/pluginutils";import H from"magic-string";import p from"typescript";import N from"clean-css";import{minify as j}from"html-minifier-next";let y;const A={getHeadTemplatePart(t){const e=t.getFullText(y),i=e.indexOf("`")+1,r=p.isTemplateHead(t)?-2:-1;return{end:t.end+r,start:t.pos+i,text:e.slice(i,e.length+r)}},getMiddleTailTemplatePart(t){const e=t.getText(y),i=p.isTemplateMiddle(t)?2:1;return{end:t.end-i,start:t.getStart(y)+1,text:e.slice(1,e.length-i)}},getRootNode(t,e=""){return p.createSourceFile(e,t,p.ScriptTarget.ESNext)},getTaggedTemplateTemplate(t){return t.template},getTagText(t){return t.tag.getText(y)},getTemplateParts(t){return p.isNoSubstitutionTemplateLiteral(t)?[this.getHeadTemplatePart(t)]:[this.getHeadTemplatePart(t.head),...t.templateSpans.map(e=>this.getMiddleTailTemplatePart(e.literal))]},isTaggedTemplate:p.isTaggedTemplateExpression,isTemplate:p.isTemplateLiteral,walkChildNodes(t,e){e(t),p.forEachChild(t,i=>{this.walkChildNodes(i,e)})},walkNodes(t,e){y=t,this.walkChildNodes(t,e),y=void 0}};var k=Object.defineProperty,V=g((t,e)=>k(t,"name",{value:e,configurable:!0}),"i");const W=V((t,e={})=>{const i={...A,...e.strategy},r=[],s=[];return i.walkNodes(i.getRootNode(t,e.fileName),a=>{if(i.isTaggedTemplate(a)){const n=i.getTaggedTemplateTemplate(a);s.push(n),r.push({parts:i.getTemplateParts(n),tag:i.getTagText(a)})}else i.isTemplate(a)&&!s.includes(a)&&r.push({parts:i.getTemplateParts(a)})}),r},"parseLiterals");var $=Object.defineProperty,C=g((t,e)=>$(t,"name",{value:e,configurable:!0}),"f");const S={One:"1",Two:"2",Zero:"0"},F=C(t=>{const e={[S.One]:{tidySelectors:!1,transform:void 0},[S.Two]:{tidySelectors:!1,transform:void 0},[S.Zero]:{}};if(t===void 0)return e;if(typeof t=="number"){const i=t.toString();return{...e,[i]:{...e[i]}}}return t},"optimizationLevelFrom"),P=C((t,e)=>{const i=/(:.+\((.*)\))\s*\{/g;let r;for(;(r=i.exec(t))!==null;){const s=r[1],a=r[2];if(!s||!a||!/\s/.test(a))continue;const n=a.replaceAll(/\s/g,""),o=s.replace(a,n),f=e.indexOf(o);if(f===-1)continue;const u=f+o.length;e=e.slice(0,Math.max(0,f))+s+e.slice(Math.max(0,u))}return e},"fixCleanCssTidySelectors"),R={},B={caseSensitive:!0,collapseWhitespace:!0,decodeEntities:!0,minifyCSS:R,minifyJS:!0,processConditionalComments:!0,removeAttributeQuotes:!1,removeComments:!0,removeEmptyAttributes:!0,removeScriptTypeAttributes:!0,removeStyleLinkTypeAttributes:!0,useShortDoctype:!0},x=C((t={})=>{const e=F(t.level),i=typeof t.level=="object"&&t.level[1]&&t.level[1].transform;return e[S.One].transform=(r,s)=>s.startsWith("@TEMPLATE_EXPRESSION")&&!s.endsWith(";")?s=`${s};`:i?i(r,s):s,{...t,level:e}},"adjustMinifyCSSOptions"),_={combineHTMLStrings(t,e){return t.map(i=>i.text).join(e)},getPlaceholder(t){let e="@TEMPLATE_EXPRESSION";for(;t.some(i=>i.text.includes(e+"();"));)e+="_";return e+"();"},minifyCSS(t,e={}){const i=x(e),r=new N(i).minify(t);if(r.errors&&r.errors.length>0)throw new Error(r.errors.join(`
2
2
 
3
- `));return i.level[S.One].tidySelectors&&(r.styles=x(t,r.styles)),r.styles},async minifyHTML(t,e={}){let i;e.minifyCSS?i=e.minifyCSS!==!0&&typeof e.minifyCSS!="function"?{...e.minifyCSS}:{}:i=!1;let r=!1;i&&(r=P(i));let s=await j(t,{...e,minifyCSS:r});if(e.collapseWhitespace){const n=[...s.matchAll(/<svg/g)].reverse();for(const a of n){const o=a.index,f=s.indexOf("</svg",o);if(f===-1)continue;const u=s.slice(0,Math.max(0,o));let l=s.substring(o,f);const d=s.slice(Math.max(0,f));l=l.replaceAll(/\r?\n/g,""),s=u+l+d}}return r&&r.level[S.One].tidySelectors&&(s=x(t,s)),s},splitHTMLByPlaceholder(t,e){const i=t.split(e);if(e.endsWith(";")){const r=e.slice(0,Math.max(0,e.length-1));for(let s=i.length-1;s>=0;s--){const n=i[s];n!==void 0&&i.splice(s,1,...n.split(r))}}return i}},P=C((t={})=>{const e=F(t.level),i=typeof t.level=="object"&&t.level[1]&&t.level[1].transform;return e[S.One].transform=(r,s)=>s.startsWith("@TEMPLATE_EXPRESSION")&&!s.endsWith(";")?s=`${s};`:i?i(r,s):s,{...t,level:e}},"adjustMinifyCSSOptions"),x=C((t,e)=>{const i=/(:.+\((.*)\))\s*\{/g;let r;for(;(r=i.exec(t))!=null;){const s=r[1],n=r[2];if(!s||!n||!/\s/.test(n))continue;const a=n.replaceAll(/\s/g,""),o=s.replace(n,a),f=e.indexOf(o);if(f===-1)continue;const u=f+o.length;e=e.slice(0,Math.max(0,f))+s+e.slice(Math.max(0,u))}return e},"fixCleanCssTidySelectors");var G=Object.defineProperty,M=g((t,e)=>G(t,"name",{value:e,configurable:!0}),"l");const I=M((t,e)=>t.generateMap({file:`${e}.map`,hires:!0,source:e}),"defaultGenerateSourceMap"),X=M(t=>{const e=t.tag&&t.tag.toLowerCase();return!!e&&(e.includes("html")||e.includes("svg"))},"defaultShouldMinify"),Z=M(t=>!!t.tag&&t.tag.toLowerCase().includes("css"),"defaultShouldMinifyCSS"),z={ensureHTMLPartsValid(t,e){if(t.length!==e.length)throw new Error("splitHTMLByPlaceholder() must return same number of strings as template parts")},ensurePlaceholderValid(t){if(typeof t!="string"||t.length===0)throw new Error("getPlaceholder() must return a non-empty string")}};async function w(t,e={}){e.minifyOptions={...B,...e.minifyOptions},e.MagicString||(e.MagicString=H),e.parseLiterals||(e.parseLiterals=W),e.shouldMinify||(e.shouldMinify=X),e.shouldMinifyCSS||(e.shouldMinifyCSS=Z),e.parseLiteralsOptions={fileName:e.fileName,...e.parseLiteralsOptions};const i=e.parseLiterals(t,e.parseLiteralsOptions),r=e.strategy||_,{shouldMinify:s,shouldMinifyCSS:n}=e;let a;e.validate!==!1&&(a=e.validate||z);const o=new e.MagicString(t);for(const l of i){const d=s(l),O=!!r.minifyCSS&&n(l);if(d||O){const v=r.getPlaceholder(l.parts);a&&a.ensurePlaceholderValid(v);const T=r.combineHTMLStrings(l.parts,v);let h;if(O){const c=(e.minifyOptions||{}).minifyCSS;if(typeof c=="function"){const m=c(T);h=typeof m=="string"?m:await m}else if(c===!1)h=T;else{const m=typeof c=="object"?c:void 0;h=await r.minifyCSS(T,m)}}else h=await r.minifyHTML(T,e.minifyOptions);const L=r.splitHTMLByPlaceholder(h,v);a&&a.ensureHTMLPartsValid(l.parts,L),l.parts.forEach((c,m)=>{c.start<c.end&&L[m]!==void 0&&o.overwrite(c.start,c.end,L[m])})}}const f=o.toString();if(t===f)return null;let u;return e.generateSourceMap!==!1&&(u=(e.generateSourceMap||I)(o,e.fileName??"")),{code:f,map:u}}g(w,"minifyHTMLLiterals");M(w,"minifyHTMLLiterals");var D=Object.defineProperty,J=g((t,e)=>D(t,"name",{value:e,configurable:!0}),"o");const te=J(({exclude:t,failOnError:e=!1,include:i,logger:r,minifyHTMLLiterals:s,options:n})=>{s||(s=w);const a=E(i,t),o=n||{};return{name:"packem:minify-html-literals",async transform(f,u){if(a(u))try{return await s(f,{...o,fileName:u})}catch(l){const d=l instanceof Error?l.message:l;e?this.error(d):r.warn({message:d,prefix:"plugin:minify-html-literals"})}}}},"minifyHTMLLiteralsPlugin");export{te as default,te as minifyHTMLLiteralsPlugin};
3
+ `));return i.level[S.One].tidySelectors&&(r.styles=P(t,r.styles)),r.styles},async minifyHTML(t,e={}){let i;e.minifyCSS?i=e.minifyCSS!==!0&&typeof e.minifyCSS!="function"?{...e.minifyCSS}:{}:i=!1;let r=!1;i&&(r=x(i));let s=await j(t,{...e,minifyCSS:r});if(e.collapseWhitespace){const a=[...s.matchAll(/<svg/g)].reverse();for(const n of a){const o=n.index,f=s.indexOf("</svg",o);if(f===-1)continue;const u=s.slice(0,Math.max(0,o));let l=s.substring(o,f);const d=s.slice(Math.max(0,f));l=l.replaceAll(/\r?\n/g,""),s=u+l+d}}return r&&r.level[S.One].tidySelectors&&(s=P(t,s)),s},splitHTMLByPlaceholder(t,e){const i=t.split(e);if(e.endsWith(";")){const r=e.slice(0,Math.max(0,e.length-1));for(let s=i.length-1;s>=0;s--){const a=i[s];a!==void 0&&i.splice(s,1,...a.split(r))}}return i}};var G=Object.defineProperty,M=g((t,e)=>G(t,"name",{value:e,configurable:!0}),"l");const I=M((t,e)=>t.generateMap({file:`${e}.map`,hires:!0,source:e}),"defaultGenerateSourceMap"),X=M(t=>{const e=t.tag&&t.tag.toLowerCase();return!!e&&(e.includes("html")||e.includes("svg"))},"defaultShouldMinify"),Z=M(t=>!!t.tag&&t.tag.toLowerCase().includes("css"),"defaultShouldMinifyCSS"),z={ensureHTMLPartsValid(t,e){if(t.length!==e.length)throw new Error("splitHTMLByPlaceholder() must return same number of strings as template parts")},ensurePlaceholderValid(t){if(typeof t!="string"||t.length===0)throw new Error("getPlaceholder() must return a non-empty string")}};async function w(t,e={}){e.minifyOptions={...B,...e.minifyOptions},e.MagicString||(e.MagicString=H),e.parseLiterals||(e.parseLiterals=W),e.shouldMinify||(e.shouldMinify=X),e.shouldMinifyCSS||(e.shouldMinifyCSS=Z),e.parseLiteralsOptions={fileName:e.fileName,...e.parseLiteralsOptions};const i=e.parseLiterals(t,e.parseLiteralsOptions),r=e.strategy||_,{shouldMinify:s,shouldMinifyCSS:a}=e;let n;e.validate!==!1&&(n=e.validate||z);const o=new e.MagicString(t);for(const l of i){const d=s(l),O=!!r.minifyCSS&&a(l);if(d||O){const v=r.getPlaceholder(l.parts);n&&n.ensurePlaceholderValid(v);const T=r.combineHTMLStrings(l.parts,v);let h;if(O){const c=(e.minifyOptions||{}).minifyCSS;if(typeof c=="function"){const m=c(T);h=typeof m=="string"?m:await m}else if(c===!1)h=T;else{const m=typeof c=="object"?c:void 0;h=await r.minifyCSS(T,m)}}else h=await r.minifyHTML(T,e.minifyOptions);const L=r.splitHTMLByPlaceholder(h,v);n&&n.ensureHTMLPartsValid(l.parts,L),l.parts.forEach((c,m)=>{c.start<c.end&&L[m]!==void 0&&o.overwrite(c.start,c.end,L[m])})}}const f=o.toString();if(t===f)return;let u;return e.generateSourceMap!==!1&&(u=(e.generateSourceMap||I)(o,e.fileName??"")),{code:f,map:u}}g(w,"minifyHTMLLiterals");M(w,"minifyHTMLLiterals");var D=Object.defineProperty,J=g((t,e)=>D(t,"name",{value:e,configurable:!0}),"o");const te=J(({exclude:t,failOnError:e=!1,include:i,logger:r,minifyHTMLLiterals:s,options:a})=>{s||(s=w);const n=E(i,t),o=a||{};return{name:"packem:minify-html-literals",async transform(f,u){if(n(u))try{return await s(f,{...o,fileName:u})}catch(l){const d=l instanceof Error?l.message:l;e?this.error(d):r.warn({message:d,prefix:"plugin:minify-html-literals"})}}}},"minifyHTMLLiteralsPlugin");export{te as default,te as minifyHTMLLiteralsPlugin};
@@ -0,0 +1,200 @@
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 { SourceMapOptions } from "magic-string";
9
+ import type { Template, TemplatePart } from "./models.d.ts";
10
+ import type { ParseLiteralsOptions } from "./parse-literals.d.ts";
11
+ import { parseLiterals } from "./parse-literals.d.ts";
12
+ import type { Strategy } from "./strategy.d.ts";
13
+ import { defaultMinifyOptions } from "./strategy.d.ts";
14
+ /**
15
+ * Options for &lt;code>minifyHTMLLiterals()&lt;/code>.
16
+ */
17
+ export type Options = DefaultOptions | CustomOptions<unknown>;
18
+ /**
19
+ * Options for &lt;code>minifyHTMLLiterals()&lt;/code>, using default html-minifier
20
+ * strategy.
21
+ */
22
+ export interface DefaultOptions extends BaseOptions {
23
+ /**
24
+ * &lt;code>html-minifier&lt;/code> options to use. Defaults to
25
+ * &lt;code>defaultMinifyOptions&lt;/code>, for production-ready minification.
26
+ */
27
+ minifyOptions?: Partial<typeof defaultMinifyOptions>;
28
+ }
29
+ /**
30
+ * Options for &lt;code>minifyHTMLLiterals()&lt;/code>, using a custom strategy.
31
+ */
32
+ export interface CustomOptions<S extends Strategy | unknown> extends BaseOptions {
33
+ /**
34
+ * HTML minification options.
35
+ */
36
+ minifyOptions?: S extends Strategy<infer O> ? Partial<O> : never;
37
+ /**
38
+ * Override the default strategy for how to minify HTML. The default is to
39
+ * use &lt;code>html-minifier&lt;/code>.
40
+ */
41
+ strategy: S;
42
+ }
43
+ /**
44
+ * Options for &lt;code>minifyHTMLLiterals()&lt;/code>.
45
+ */
46
+ export interface BaseOptions {
47
+ /**
48
+ * The name of the file. This is used to determine how to parse the source
49
+ * code and for source map filenames. It may be a base name, relative, or
50
+ * absolute path.
51
+ */
52
+ fileName?: string;
53
+ /**
54
+ * Override how source maps are generated. Set to false to disable source map
55
+ * generation.
56
+ * @param ms the MagicString instance with code modifications
57
+ * @param fileName the name or path of the file
58
+ * @returns a v3 SourceMap or undefined
59
+ */
60
+ generateSourceMap?: ((ms: MagicStringLike, fileName: string) => SourceMap | undefined) | false;
61
+ /**
62
+ * The MagicString-like constructor to use. MagicString is used to replace
63
+ * strings and generate source maps.
64
+ *
65
+ * Override if you want to set your own version of MagicString or change how
66
+ * strings are overridden. Use &lt;code>generateSourceMap&lt;/code> if you want to
67
+ * change how source maps are created.
68
+ */
69
+ MagicString?: new (source: string) => MagicStringLike;
70
+ /**
71
+ * Override how template literals are parsed from a source string.
72
+ */
73
+ parseLiterals?: typeof parseLiterals;
74
+ /**
75
+ * Options for &lt;code>parseLiterals()&lt;/code>.
76
+ */
77
+ parseLiteralsOptions?: Partial<ParseLiteralsOptions>;
78
+ /**
79
+ * Determines whether or not a template should be minified. The default is to
80
+ * minify all tagged template whose tag name contains "html" (case
81
+ * insensitive).
82
+ * @param template the template to check
83
+ * @returns true if the template should be minified
84
+ */
85
+ shouldMinify?: (template: Template) => boolean;
86
+ /**
87
+ * Determines whether or not a CSS template should be minified. The default is
88
+ * to minify all tagged template whose tag name contains "css" (case
89
+ * insensitive).
90
+ * @param template the template to check
91
+ * @returns true if the template should be minified
92
+ */
93
+ shouldMinifyCSS?: (template: Template) => boolean;
94
+ /**
95
+ * Override custom validation or set to false to disable validation. This is
96
+ * only useful when implementing your own strategy that may return
97
+ * unexpected results.
98
+ */
99
+ validate?: Validation | false;
100
+ }
101
+ /**
102
+ * A MagicString-like instance. &lt;code>minify-html-literals&lt;/code> only uses a
103
+ * subset of the MagicString API to overwrite the source code and generate
104
+ * source maps.
105
+ */
106
+ export interface MagicStringLike {
107
+ generateMap: (options?: Partial<SourceMapOptions>) => SourceMap;
108
+ overwrite: (start: number, end: number, content: string) => unknown;
109
+ toString: () => string;
110
+ }
111
+ /**
112
+ * A v3 SourceMap.
113
+ *
114
+ * &lt;code>magic-string> incorrectly declares the SourceMap type with a version
115
+ * string instead of a number, so &lt;code>minify-html-literals&lt;/code> declares
116
+ * its own type.
117
+ */
118
+ export interface SourceMap {
119
+ file?: string;
120
+ mappings: string;
121
+ names: string[];
122
+ sources: string[];
123
+ sourcesContent?: string[];
124
+ toString: () => string;
125
+ toUrl: () => string;
126
+ version: number;
127
+ }
128
+ /**
129
+ * Validation that is executed when minifying HTML to ensure there are no
130
+ * unexpected errors. This is to alleviate hard-to-troubleshoot errors such as
131
+ * undefined errors.
132
+ */
133
+ export interface Validation {
134
+ /**
135
+ * Throws an error if &lt;code>strategy.splitHTMLByPlaceholder()&lt;/code> does not
136
+ * return an HTML part string for each template part.
137
+ * @param parts the template parts that generated the strings
138
+ * @param htmlParts the split HTML strings
139
+ */
140
+ ensureHTMLPartsValid: (parts: TemplatePart[], htmlParts: string[]) => void;
141
+ /**
142
+ * Throws an error if &lt;code>strategy.getPlaceholder()&lt;/code> does not return
143
+ * a valid placeholder string.
144
+ * @param placeholder the placeholder to check
145
+ */
146
+ ensurePlaceholderValid: (placeholder: unknown) => void;
147
+ }
148
+ /**
149
+ * The result of a call to &lt;code>minifyHTMLLiterals()&lt;/code>.
150
+ */
151
+ export interface Result {
152
+ /**
153
+ * The minified code.
154
+ */
155
+ code: string;
156
+ /**
157
+ * Optional v3 SourceMap for the code.
158
+ */
159
+ map: SourceMap | undefined;
160
+ }
161
+ /**
162
+ * The default method to generate a SourceMap. It will generate the SourceMap
163
+ * from the provided MagicString instance using "fileName.map" as the file and
164
+ * "fileName" as the source.
165
+ * @param ms the MagicString instance with code modifications
166
+ * @param fileName the name of the source file
167
+ * @returns a v3 SourceMap
168
+ */
169
+ export declare const defaultGenerateSourceMap: (ms: MagicStringLike, fileName: string) => SourceMap;
170
+ /**
171
+ * The default method to determine whether or not to minify a template. It will
172
+ * return true for all tagged templates whose tag name contains "html" (case
173
+ * insensitive).
174
+ * @param template the template to check
175
+ * @returns true if the template should be minified
176
+ */
177
+ export declare const defaultShouldMinify: (template: Template) => boolean;
178
+ /**
179
+ * The default method to determine whether or not to minify a CSS template. It
180
+ * will return true for all tagged templates whose tag name contains "css" (case
181
+ * insensitive).
182
+ * @param template the template to check
183
+ * @returns true if the template should be minified
184
+ */
185
+ export declare const defaultShouldMinifyCSS: (template: Template) => boolean;
186
+ export declare const defaultValidation: Validation;
187
+ /**
188
+ * Minifies all HTML template literals in the provided source string.
189
+ * @param source the source code
190
+ * @param options minification options
191
+ * @returns the minified code, or null if no minification occurred.
192
+ */
193
+ export declare function minifyHTMLLiterals(source: string, options?: DefaultOptions): Promise<Result | null>;
194
+ /**
195
+ * Minifies all HTML template literals in the provided source string.
196
+ * @param source the source code
197
+ * @param options minification options
198
+ * @returns the minified code, or null if no minification occurred.
199
+ */
200
+ export declare function minifyHTMLLiterals<S extends Strategy>(source: string, options?: CustomOptions<S>): Promise<Result | undefined>;
@@ -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 &lt;code>clean-css&lt;/code> options, optimized for production
56
+ * minification.
57
+ */
58
+ export declare const defaultMinifyCSSOptions: CleanCSS.Options;
59
+ /**
60
+ * The default &lt;code>html-minifier&lt;/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 &lt;code>html-minifier&lt;/code> to minify HTML and
67
+ * &lt;code>clean-css&lt;/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;
@@ -1,9 +1,14 @@
1
- import { Plugin } from 'rollup';
2
-
3
- interface NativeModulesOptions {
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
+ */
4
7
  nativesDirectory?: string;
5
8
  }
6
- declare const nativeModulesPlugin: (config?: NativeModulesOptions) => Plugin;
7
-
8
- export { nativeModulesPlugin };
9
- export type { NativeModulesOptions };
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;
@@ -1 +1 @@
1
- var $=Object.defineProperty;var m=(u,i)=>$(u,"name",{value:i,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((u,i)=>x(u,"name",{value:i,configurable:!0}),"c");const d="\0natives:",q=y((u={})=>{const{nativesDirectory:i="natives"}=u,s=new Map;let o;return{buildStart(){s.clear()},generateBundle:y(async t=>{if(!o){const e=Array.isArray(t)?t[0]:t;e&&e.dir?o=e.dir:e&&e.file&&(o=c(e.file))}if(s.size===0)return;if(!o){(void 0).error("Output directory not detected. Please ensure Rollup output options are configured.");return}const r=g(o,i);await P(r),await Promise.all([...s.entries()].map(([e,n])=>{const a=g(r,n);return w(e,a)}))},"generateBundle"),load(t){if(!t.startsWith(d))return;const r=t.slice(d.length),e=s.get(r);if(e||this.error(`Could not find staged native module for: ${r}`),!o){const n=this;if(n&&n.meta&&n.meta.rollupVersion)return`export default require("./${i}/${e}");`;this.error("Output directory not detected. Please ensure Rollup output options are configured.")}return`export default require("${`./${i}/${e}`.replaceAll("\\","/")}");`},name:"native-modules",options(t){const r=t;if(r.output){const e=Array.isArray(r.output)?r.output[0]:r.output;e.dir?o=e.dir:e.file&&(o=c(e.file))}return t},async resolveId(t,r){if(t.startsWith(d)||!t.endsWith(".node"))return;const e=r?v(c(r),t):v(t);if(!await A(e)){this.warn(`Native module not found: ${e}`);return}const n=f(e);let a=n,p=1;const h=new Set([...s.values()].map(l=>f(l)));for(;h.has(a);){const l=b(n);a=`${f(n,l)}_${p}${l}`,p+=1}return s.set(e,a),d+e}}},"nativeModulesPlugin");export{q as nativeModulesPlugin};
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,45 +1,4 @@
1
- import { IsolatedDeclarationsOptions } from 'oxc-transform';
2
- import { I as IsolatedDeclarationsResult, i as OxcResolveOptions, T as TransformerFn } from '../../packem_shared/types-BiZanzz1.js';
3
- export { j as InternalOXCTransformPluginConfig, k as OXCTransformPluginConfig } from '../../packem_shared/types-BiZanzz1.js';
4
- import { Plugin } from 'rollup';
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 '../cjs-interop.js';
17
- import '../copy.js';
18
- import '../data-uri.js';
19
- import '../debarrel.js';
20
- import 'esbuild';
21
- import '../esm-shim-cjs-syntax.js';
22
- import '@visulima/package';
23
- import '../isolated-declarations/index.js';
24
- import '@visulima/packem-share/types';
25
- import '../jsx-remove-attributes.js';
26
- import '../license.js';
27
- import '../minify-html-literals/index.js';
28
- import 'magic-string';
29
- import 'html-minifier-next';
30
- import '../native-modules-plugin.js';
31
- import 'oxc-resolver';
32
- import '../raw.js';
33
- import '../require-cjs-transformer.js';
34
- import '../shebang.js';
35
- import '../source-maps.js';
36
- import 'sucrase';
37
- import '../url.js';
38
-
39
- declare const isolatedDeclarationsOxcTransformer: (id: string, code: string, sourceMap?: boolean, transformOptions?: Omit<IsolatedDeclarationsOptions, "sourcemap">) => IsolatedDeclarationsResult;
40
-
41
- declare const oxcResolvePlugin: (options: OxcResolveOptions, rootDirectory: string, logger: Console, tsconfigPath?: string) => Plugin;
42
-
43
- declare const oxcTransformPlugin: TransformerFn;
44
-
45
- 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,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,4 @@
1
+ import type { Plugin } from "rollup";
2
+ import type { OxcResolveOptions } from "./types.d.ts";
3
+ declare const oxcResolvePlugin: (options: OxcResolveOptions, rootDirectory: string, logger: Console, tsconfigPath?: string) => Plugin;
4
+ export default oxcResolvePlugin;
@@ -0,0 +1,3 @@
1
+ import type { TransformerFn as TransformerFunction } from "../../types.d.ts";
2
+ declare const oxcTransformPlugin: TransformerFunction;
3
+ export default oxcTransformPlugin;
@@ -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
+ };