@visulima/packem 2.0.0-alpha.43 → 2.0.0-alpha.44
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 +6 -0
- package/LICENSE.md +156 -102
- package/dist/builder/typedoc/generate-reference-documentation.d.ts +4 -0
- package/dist/builder/typedoc/index.js +3 -160
- package/dist/cli/commands/add.d.ts +4 -0
- package/dist/cli/commands/build.d.ts +21 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/migrate.d.ts +21 -0
- package/dist/cli/commands/utils/css-loader-dependencies.d.ts +2 -0
- package/dist/cli/index.js +52 -1377
- package/dist/config/index.js +1 -4
- package/dist/config/preset/auto.d.ts +3 -0
- package/dist/config/preset/react.js +1 -43
- package/dist/config/preset/solid.js +1 -72
- package/dist/config/preset/svelte.d.ts +1 -1
- package/dist/config/preset/svelte.js +1 -44
- package/dist/config/preset/utils/infer-entries.d.ts +12 -0
- package/dist/config/preset/utils/overwrite-with-publish-config.d.ts +4 -0
- package/dist/config/preset/vue.js +1 -33
- package/dist/config/utils/find-packem-file.d.ts +2 -0
- package/dist/config/utils/load-package-json.d.ts +6 -0
- package/dist/config/utils/load-packem-config.d.ts +7 -0
- package/dist/config/utils/load-preset.d.ts +4 -0
- package/dist/config/utils/load-tsconfig.d.ts +5 -0
- package/dist/config/utils/prepare-entries.d.ts +4 -0
- package/dist/index.js +1 -30
- package/dist/jit/create-stub.d.ts +4 -0
- package/dist/packem/build.d.ts +21 -0
- package/dist/packem/index.d.ts +25 -0
- package/dist/packem/utils/brotli-size.d.ts +2 -0
- package/dist/packem/utils/group-by-keys.d.ts +3 -0
- package/dist/packem/utils/gzip-size.d.ts +2 -0
- package/dist/packem_shared/browserslistToEsbuild-C0IWmbNe-C6xPL1oW.js +1 -0
- package/dist/packem_shared/create-or-update-key-storage-C0tWtgSr.js +3 -0
- package/dist/packem_shared/default-5XUc-qHw.js +1 -0
- package/dist/packem_shared/default-B2EOH52z.js +1 -0
- package/dist/packem_shared/default-BYM_JvQL.js +1 -0
- package/dist/packem_shared/default-B_dUKZ_J.js +1 -0
- package/dist/packem_shared/default-DsjSAv7m.js +1 -0
- package/dist/packem_shared/esbuildPlugin-pPPsJB9N-YI_X-5wr.js +3 -0
- package/dist/packem_shared/index-CUp9WuCG.js +1 -0
- package/dist/packem_shared/index-ChtiNkgT.js +174 -0
- package/dist/packem_shared/isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.js +1 -0
- package/dist/packem_shared/isolatedDeclarationsSwcTransformer-Ch2AgtWC-B-0lOgFf.js +1 -0
- package/dist/packem_shared/isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js +3 -0
- package/dist/packem_shared/oxcResolvePlugin-Ccef6pyL-D14z9S9i.js +1 -0
- package/dist/packem_shared/oxcTransformPlugin-DfVQouIB-Cpfv95eA.js +4 -0
- package/dist/packem_shared/resolveTypescriptMjsCtsPlugin-DcZrZTmM-CauidYR5.js +6 -0
- package/dist/packem_shared/swcPlugin-Boip4lWG-CwJ-HVJc.js +1 -0
- package/dist/rollup/build-types.d.ts +5 -0
- package/dist/rollup/build.d.ts +5 -0
- package/dist/rollup/get-rollup-options.d.ts +5 -0
- package/dist/rollup/plugins/css/loaders/less.js +1 -1
- package/dist/rollup/plugins/css/loaders/lightningcss.js +1 -1
- package/dist/rollup/plugins/css/loaders/postcss.js +1 -1
- package/dist/rollup/plugins/css/loaders/sass.js +1 -1
- package/dist/rollup/plugins/css/loaders/sourcemap.js +1 -1
- package/dist/rollup/plugins/css/loaders/stylus.js +1 -1
- package/dist/rollup/plugins/css/loaders/tailwindcss.js +1 -1
- package/dist/rollup/plugins/css/minifiers/cssnano.js +1 -1
- package/dist/rollup/plugins/css/minifiers/lightningcss.js +1 -1
- package/dist/rollup/plugins/esbuild/index.js +1 -1
- package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.js +1 -1
- package/dist/rollup/plugins/oxc/oxc-transformer.js +1 -1
- package/dist/rollup/plugins/sucrase/index.js +1 -1
- package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.js +1 -1
- package/dist/rollup/plugins/swc/swc-plugin.js +1 -1
- package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +1 -1
- package/dist/rollup/utils/resolve-aliases.d.ts +4 -0
- package/dist/rollup/watch.d.ts +5 -0
- package/dist/utils/clean-distribution-directories.d.ts +4 -0
- package/dist/utils/create-or-update-key-storage.d.ts +3 -0
- package/dist/utils/extract-export-filenames.d.ts +16 -0
- package/dist/utils/find-alternatives.d.ts +2 -0
- package/dist/utils/get-package-side-effect.d.ts +3 -0
- package/dist/utils/infer-export-type.d.ts +3 -0
- package/dist/utils/kill-process.d.ts +14 -0
- package/dist/utils/log-build-errors.d.ts +4 -0
- package/dist/utils/remove-old-cache-folders.d.ts +3 -0
- package/dist/utils/warn-legacy-cjs.d.ts +8 -0
- package/dist/validator/attw.d.ts +7 -0
- package/dist/validator/package-json/index.d.ts +4 -0
- package/dist/validator/package-json/validate-dependencies.d.ts +4 -0
- package/dist/validator/package-json/validate-engines.d.ts +4 -0
- package/dist/validator/package-json/validate-package-entries.d.ts +4 -0
- package/dist/validator/package-json/validate-package-fields.d.ts +4 -0
- package/dist/validator/validate-alias-entries.d.ts +3 -0
- package/dist/validator/validate-bundle-size.d.ts +4 -0
- package/package.json +1 -111
- package/dist/packem_shared/create-or-update-key-storage-Dd7b8-t1.js +0 -36
- package/dist/packem_shared/default-79SPobLI.js +0 -12
- package/dist/packem_shared/default-DWBYeUSC.js +0 -210
- package/dist/packem_shared/default-DaU6CQEi.js +0 -28
- package/dist/packem_shared/default-DavaZMwC.js +0 -32
- package/dist/packem_shared/default-DeYZ934H.js +0 -32
- package/dist/packem_shared/default-tUOOZ8w7.js +0 -42
- package/dist/packem_shared/default-wScAfTaq.js +0 -27
- package/dist/packem_shared/index-CTIRxV2x.js +0 -63
- package/dist/packem_shared/index-DzTDn4ad.js +0 -9521
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { createFilter } from '@rollup/pluginutils';
|
|
2
|
-
import { a as DEFAULT_LOADERS } from './index-CTIRxV2x.js';
|
|
3
|
-
import { extname, join } from '@visulima/path';
|
|
4
|
-
import { transform, formatMessages, build } from 'esbuild';
|
|
5
|
-
import { findCacheDirSync } from '@visulima/find-cache-dir';
|
|
6
|
-
import { readFileSync } from '@visulima/fs';
|
|
7
|
-
import * as rsModuleLexer from 'rs-module-lexer';
|
|
8
|
-
|
|
9
|
-
import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
10
|
-
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
11
|
-
const warn = async (pluginContext, messages) => {
|
|
12
|
-
if (messages.length > 0) {
|
|
13
|
-
const warnings = await formatMessages(messages, {
|
|
14
|
-
color: true,
|
|
15
|
-
kind: "warning"
|
|
16
|
-
});
|
|
17
|
-
warnings.forEach((warning) => pluginContext.warn(warning));
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
const getEsbuildFormat = (rollupFormat) => {
|
|
21
|
-
if (rollupFormat === "es") {
|
|
22
|
-
return "esm";
|
|
23
|
-
}
|
|
24
|
-
if (rollupFormat === "cjs") {
|
|
25
|
-
return rollupFormat;
|
|
26
|
-
}
|
|
27
|
-
return void 0;
|
|
28
|
-
};
|
|
29
|
-
const getRenderChunk = ({ sourceMap = true, ...options }) => (
|
|
30
|
-
// eslint-disable-next-line func-names
|
|
31
|
-
(async function(code, _, rollupOptions) {
|
|
32
|
-
if (options.minify || options.minifyWhitespace || options.minifyIdentifiers || options.minifySyntax) {
|
|
33
|
-
const format = getEsbuildFormat(rollupOptions.format);
|
|
34
|
-
const result = await transform(code, {
|
|
35
|
-
format,
|
|
36
|
-
loader: "js",
|
|
37
|
-
sourcemap: sourceMap,
|
|
38
|
-
...options
|
|
39
|
-
});
|
|
40
|
-
await warn(this, result.warnings);
|
|
41
|
-
if (result.code) {
|
|
42
|
-
return {
|
|
43
|
-
code: result.code,
|
|
44
|
-
map: result.map || void 0
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return void 0;
|
|
49
|
-
})
|
|
50
|
-
);
|
|
51
|
-
const slash = (p) => p.replaceAll("\\", "/");
|
|
52
|
-
const { parseAsync } = rsModuleLexer;
|
|
53
|
-
const optimizeDeps = async (options) => {
|
|
54
|
-
const cacheDir = findCacheDirSync("@visulima/packem/optimize-deps", {
|
|
55
|
-
create: true,
|
|
56
|
-
cwd: options.cwd
|
|
57
|
-
});
|
|
58
|
-
if (!cacheDir) {
|
|
59
|
-
throw new Error('[packem:optimize-deps]: failed to find or create cache directory "node_modules/.cache/packem/optimize_deps".');
|
|
60
|
-
}
|
|
61
|
-
await build({
|
|
62
|
-
absWorkingDir: options.cwd,
|
|
63
|
-
bundle: true,
|
|
64
|
-
entryPoints: options.include,
|
|
65
|
-
format: "esm",
|
|
66
|
-
ignoreAnnotations: true,
|
|
67
|
-
metafile: true,
|
|
68
|
-
outdir: cacheDir,
|
|
69
|
-
sourcemap: options.sourceMap,
|
|
70
|
-
splitting: true,
|
|
71
|
-
...options.esbuildOptions,
|
|
72
|
-
plugins: [
|
|
73
|
-
{
|
|
74
|
-
name: "optimize-deps",
|
|
75
|
-
async setup(build2) {
|
|
76
|
-
build2.onResolve({ filter: /.*/ }, async (arguments_) => {
|
|
77
|
-
if (options.exclude?.includes(arguments_.path)) {
|
|
78
|
-
return {
|
|
79
|
-
external: true
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
if (arguments_.pluginData?.__resolving_dep_path__) {
|
|
83
|
-
return void 0;
|
|
84
|
-
}
|
|
85
|
-
if (options.include.includes(arguments_.path)) {
|
|
86
|
-
const resolved = await build2.resolve(arguments_.path, {
|
|
87
|
-
kind: "import-statement",
|
|
88
|
-
pluginData: { __resolving_dep_path__: true },
|
|
89
|
-
resolveDir: arguments_.resolveDir
|
|
90
|
-
});
|
|
91
|
-
if (resolved.errors.length > 0 || resolved.warnings.length > 0) {
|
|
92
|
-
return resolved;
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
namespace: "optimize-deps",
|
|
96
|
-
path: arguments_.path,
|
|
97
|
-
pluginData: {
|
|
98
|
-
absolute: resolved.path,
|
|
99
|
-
resolveDir: arguments_.resolveDir
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
return void 0;
|
|
104
|
-
});
|
|
105
|
-
build2.onLoad({ filter: /.*/, namespace: "optimize-deps" }, async (arguments_) => {
|
|
106
|
-
const { absolute, resolveDir } = arguments_.pluginData;
|
|
107
|
-
const sourceCode = readFileSync(absolute);
|
|
108
|
-
const { output } = await parseAsync({ input: [{ code: sourceCode, filename: absolute }] });
|
|
109
|
-
const exported = output[0]?.exports ?? [];
|
|
110
|
-
return {
|
|
111
|
-
contents: exported.length > 0 ? `export * from '${slash(absolute)}'` : `module.exports = require('${slash(absolute)}')`,
|
|
112
|
-
resolveDir
|
|
113
|
-
};
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
...options.esbuildOptions?.plugins ?? []
|
|
118
|
-
]
|
|
119
|
-
});
|
|
120
|
-
const optimized = /* @__PURE__ */ new Map();
|
|
121
|
-
for (const id of options.include) {
|
|
122
|
-
optimized.set(id, { file: join(cacheDir, `${id}.js`) });
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
cacheDir,
|
|
126
|
-
optimized
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
const esbuildTransformer = ({ exclude, include, loaders: _loaders, logger, optimizeDeps: optimizeDeps$1, sourceMap, ...esbuildOptions }) => {
|
|
130
|
-
const loaders = DEFAULT_LOADERS;
|
|
131
|
-
if (_loaders !== void 0) {
|
|
132
|
-
for (let [key, value] of Object.entries(_loaders)) {
|
|
133
|
-
const newKey = key.startsWith(".") ? key : `.${key}`;
|
|
134
|
-
if (typeof value === "string") {
|
|
135
|
-
loaders[newKey] = value;
|
|
136
|
-
} else if (!value) {
|
|
137
|
-
delete loaders[newKey];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
const extensions = Object.keys(loaders);
|
|
142
|
-
const INCLUDE_REGEXP = new RegExp(String.raw`\.(${extensions.map((extension) => extension.slice(1)).join("|")})$`);
|
|
143
|
-
const filter = createFilter(include ?? INCLUDE_REGEXP, exclude);
|
|
144
|
-
let optimizeDepsResult;
|
|
145
|
-
let cwd = process.cwd();
|
|
146
|
-
return {
|
|
147
|
-
async buildStart() {
|
|
148
|
-
if (!optimizeDeps$1 || optimizeDepsResult) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
optimizeDepsResult = await optimizeDeps({
|
|
152
|
-
cwd,
|
|
153
|
-
sourceMap: sourceMap ?? false,
|
|
154
|
-
...optimizeDeps$1
|
|
155
|
-
});
|
|
156
|
-
logger.debug("optimized %O", optimizeDepsResult.optimized);
|
|
157
|
-
},
|
|
158
|
-
name: "packem:esbuild",
|
|
159
|
-
options({ context }) {
|
|
160
|
-
if (context) {
|
|
161
|
-
cwd = context;
|
|
162
|
-
}
|
|
163
|
-
return void 0;
|
|
164
|
-
},
|
|
165
|
-
renderChunk: getRenderChunk({
|
|
166
|
-
...esbuildOptions,
|
|
167
|
-
sourceMap
|
|
168
|
-
}),
|
|
169
|
-
async resolveId(id) {
|
|
170
|
-
if (optimizeDepsResult?.optimized.has(id)) {
|
|
171
|
-
const m = optimizeDepsResult.optimized.get(id);
|
|
172
|
-
if (m) {
|
|
173
|
-
logger.debug("resolved %s to %s", id, m.file);
|
|
174
|
-
return m.file;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return void 0;
|
|
178
|
-
},
|
|
179
|
-
async transform(code, id) {
|
|
180
|
-
if (!filter(id) || optimizeDepsResult?.optimized.has(id)) {
|
|
181
|
-
return void 0;
|
|
182
|
-
}
|
|
183
|
-
const extension = extname(id);
|
|
184
|
-
const loader = loaders[extension];
|
|
185
|
-
logger.debug("transforming %s with %s loader", id, loader);
|
|
186
|
-
if (!loader) {
|
|
187
|
-
return void 0;
|
|
188
|
-
}
|
|
189
|
-
const result = await transform(code, {
|
|
190
|
-
format: ["base64", "binary", "dataurl", "text", "json"].includes(loader) ? "esm" : void 0,
|
|
191
|
-
loader,
|
|
192
|
-
// @see https://github.com/evanw/esbuild/issues/1932#issuecomment-1013380565
|
|
193
|
-
sourcefile: id.replace(/\.[cm]ts/, ".ts"),
|
|
194
|
-
sourcemap: sourceMap,
|
|
195
|
-
...esbuildOptions
|
|
196
|
-
});
|
|
197
|
-
await warn(this, result.warnings);
|
|
198
|
-
if (result.code) {
|
|
199
|
-
return {
|
|
200
|
-
code: result.code,
|
|
201
|
-
map: result.map || void 0
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
return void 0;
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
esbuildTransformer.NAME = "esbuild";
|
|
209
|
-
|
|
210
|
-
export { esbuildTransformer as default };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createFilter } from '@rollup/pluginutils';
|
|
2
|
-
import { transform } from '@swc/core';
|
|
3
|
-
import { E as EXCLUDE_REGEXP } from './index-CTIRxV2x.js';
|
|
4
|
-
|
|
5
|
-
const swcPlugin = ({ exclude, include, ...transformOptions }) => {
|
|
6
|
-
const filter = createFilter(include, exclude ?? EXCLUDE_REGEXP);
|
|
7
|
-
return {
|
|
8
|
-
name: "packem:swc",
|
|
9
|
-
async transform(sourcecode, id) {
|
|
10
|
-
if (!filter(id)) {
|
|
11
|
-
return void 0;
|
|
12
|
-
}
|
|
13
|
-
const { code, map } = await transform(sourcecode, {
|
|
14
|
-
...transformOptions,
|
|
15
|
-
configFile: false,
|
|
16
|
-
filename: id,
|
|
17
|
-
swcrc: false
|
|
18
|
-
});
|
|
19
|
-
return {
|
|
20
|
-
code,
|
|
21
|
-
map
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
swcPlugin.NAME = "swc";
|
|
27
|
-
|
|
28
|
-
export { swcPlugin as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { transform } from '@swc/core';
|
|
2
|
-
|
|
3
|
-
const isolatedDeclarationsSwcTransformer = async (id, code, sourceMap) => {
|
|
4
|
-
try {
|
|
5
|
-
const result = await transform(code, {
|
|
6
|
-
filename: id,
|
|
7
|
-
jsc: {
|
|
8
|
-
experimental: {
|
|
9
|
-
emitIsolatedDts: true
|
|
10
|
-
},
|
|
11
|
-
parser: {
|
|
12
|
-
syntax: "typescript",
|
|
13
|
-
tsx: false
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
sourceMaps: sourceMap
|
|
17
|
-
});
|
|
18
|
-
const output = JSON.parse(result.output);
|
|
19
|
-
return {
|
|
20
|
-
errors: [],
|
|
21
|
-
map: result.map ? JSON.parse(result.map).mappings : void 0,
|
|
22
|
-
sourceText: output.__swc_isolated_declarations__
|
|
23
|
-
};
|
|
24
|
-
} catch (error) {
|
|
25
|
-
return {
|
|
26
|
-
errors: [error.toString()],
|
|
27
|
-
sourceText: ""
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export { isolatedDeclarationsSwcTransformer as default };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createFilter } from '@rollup/pluginutils';
|
|
2
|
-
import { E as EXCLUDE_REGEXP } from './index-CTIRxV2x.js';
|
|
3
|
-
import { transform } from 'oxc-transform';
|
|
4
|
-
|
|
5
|
-
const oxcTransformPlugin = ({ exclude, include, ...transformOptions }) => {
|
|
6
|
-
const filter = createFilter(include, exclude ?? EXCLUDE_REGEXP);
|
|
7
|
-
return {
|
|
8
|
-
name: "packem:oxc-transform",
|
|
9
|
-
async transform(sourcecode, id) {
|
|
10
|
-
if (!filter(id)) {
|
|
11
|
-
return void 0;
|
|
12
|
-
}
|
|
13
|
-
const { code, errors, map } = transform(id, sourcecode, {
|
|
14
|
-
...transformOptions,
|
|
15
|
-
sourcemap: true
|
|
16
|
-
});
|
|
17
|
-
if (errors.length > 0) {
|
|
18
|
-
return this.error({
|
|
19
|
-
message: ["\ntransform errors:", ...errors].join("\n\n"),
|
|
20
|
-
pluginCode: "ERR_TRANSFORM"
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
code,
|
|
25
|
-
map
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
oxcTransformPlugin.NAME = "oxc";
|
|
31
|
-
|
|
32
|
-
export { oxcTransformPlugin as default };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { transpileDeclaration, formatDiagnostics, sys } from 'typescript';
|
|
2
|
-
|
|
3
|
-
const stripMapUrl = (code) => {
|
|
4
|
-
const lines = code.split("\n");
|
|
5
|
-
const lastLine = lines.at(-1);
|
|
6
|
-
if (lastLine?.startsWith("//# sourceMappingURL=")) {
|
|
7
|
-
return lines.slice(0, -1).join("\n");
|
|
8
|
-
}
|
|
9
|
-
return code;
|
|
10
|
-
};
|
|
11
|
-
const isolatedDeclarationsTypescriptTransformer = async (id, code, sourceMap, transformOptions) => {
|
|
12
|
-
const compilerOptions = {
|
|
13
|
-
declarationMap: sourceMap,
|
|
14
|
-
...transformOptions?.compilerOptions
|
|
15
|
-
};
|
|
16
|
-
let { diagnostics, outputText, sourceMapText } = transpileDeclaration(code, {
|
|
17
|
-
fileName: id,
|
|
18
|
-
reportDiagnostics: true,
|
|
19
|
-
...transformOptions,
|
|
20
|
-
compilerOptions
|
|
21
|
-
});
|
|
22
|
-
if (compilerOptions.declarationMap) {
|
|
23
|
-
outputText = stripMapUrl(outputText);
|
|
24
|
-
}
|
|
25
|
-
const errors = diagnostics?.length ? [
|
|
26
|
-
formatDiagnostics(diagnostics, {
|
|
27
|
-
getCanonicalFileName: (fileName) => sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
|
|
28
|
-
getCurrentDirectory: () => sys.getCurrentDirectory(),
|
|
29
|
-
getNewLine: () => sys.newLine
|
|
30
|
-
})
|
|
31
|
-
] : [];
|
|
32
|
-
if (sourceMapText) {
|
|
33
|
-
sourceMapText = JSON.parse(sourceMapText).mappings;
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
errors,
|
|
37
|
-
map: sourceMapText,
|
|
38
|
-
sourceText: outputText
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export { isolatedDeclarationsTypescriptTransformer as default };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createFilter } from '@rollup/pluginutils';
|
|
2
|
-
import { E as EXCLUDE_REGEXP } from './index-CTIRxV2x.js';
|
|
3
|
-
import { transform } from 'sucrase';
|
|
4
|
-
|
|
5
|
-
const sucraseTransformPlugin = ({ exclude, include, ...transformOptions }) => {
|
|
6
|
-
const filter = createFilter(include, exclude ?? EXCLUDE_REGEXP);
|
|
7
|
-
return {
|
|
8
|
-
name: "packem:sucrase",
|
|
9
|
-
async transform(sourcecode, id) {
|
|
10
|
-
if (!filter(id)) {
|
|
11
|
-
return void 0;
|
|
12
|
-
}
|
|
13
|
-
const { code, sourceMap: map } = transform(sourcecode, {
|
|
14
|
-
...transformOptions,
|
|
15
|
-
filePath: id,
|
|
16
|
-
sourceMapOptions: {
|
|
17
|
-
compiledFilename: id
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
return { code, map };
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
sucraseTransformPlugin.NAME = "sucrase";
|
|
25
|
-
const sucrasePlugin = sucraseTransformPlugin;
|
|
26
|
-
|
|
27
|
-
export { sucrasePlugin };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const VALID_EXPORT_EXTENSIONS = [
|
|
2
|
-
".js",
|
|
3
|
-
".mjs",
|
|
4
|
-
".cjs",
|
|
5
|
-
// JavaScript modules
|
|
6
|
-
".ts",
|
|
7
|
-
".mts",
|
|
8
|
-
".cts",
|
|
9
|
-
// TypeScript modules
|
|
10
|
-
".d.ts",
|
|
11
|
-
".d.mts",
|
|
12
|
-
".d.cts",
|
|
13
|
-
// TypeScript declarations
|
|
14
|
-
".jsx",
|
|
15
|
-
".tsx",
|
|
16
|
-
// JSX/TSX files
|
|
17
|
-
".json",
|
|
18
|
-
// JSON modules
|
|
19
|
-
".node"
|
|
20
|
-
// Native Node.js modules (compiled C++ addons)
|
|
21
|
-
];
|
|
22
|
-
const DEFAULT_EXTENSIONS = [
|
|
23
|
-
...VALID_EXPORT_EXTENSIONS,
|
|
24
|
-
// Base extensions for all module types
|
|
25
|
-
".ctsx",
|
|
26
|
-
".mtsx"
|
|
27
|
-
// Additional JSX/TSX variants (not standard for exports but processable)
|
|
28
|
-
];
|
|
29
|
-
const DEFAULT_LOADERS = {
|
|
30
|
-
".aac": "file",
|
|
31
|
-
".cjs": "js",
|
|
32
|
-
".cts": "ts",
|
|
33
|
-
".ctsx": "tsx",
|
|
34
|
-
".eot": "file",
|
|
35
|
-
".flac": "file",
|
|
36
|
-
".js": "js",
|
|
37
|
-
".jsx": "jsx",
|
|
38
|
-
".mjs": "js",
|
|
39
|
-
".mp3": "file",
|
|
40
|
-
".mp4": "file",
|
|
41
|
-
".mts": "ts",
|
|
42
|
-
".mtsx": "tsx",
|
|
43
|
-
".ogg": "file",
|
|
44
|
-
".otf": "file",
|
|
45
|
-
".ts": "ts",
|
|
46
|
-
".tsx": "tsx",
|
|
47
|
-
".ttf": "file",
|
|
48
|
-
".wav": "file",
|
|
49
|
-
".webm": "file",
|
|
50
|
-
".woff": "file",
|
|
51
|
-
".woff2": "file"
|
|
52
|
-
};
|
|
53
|
-
const PRODUCTION_ENV = "production";
|
|
54
|
-
const DEVELOPMENT_ENV = "development";
|
|
55
|
-
const RUNTIME_EXPORT_CONVENTIONS = /* @__PURE__ */ new Set(["edge-light", "react-native", "react-server"]);
|
|
56
|
-
const SPECIAL_EXPORT_CONVENTIONS = /* @__PURE__ */ new Set([DEVELOPMENT_ENV, PRODUCTION_ENV, ...RUNTIME_EXPORT_CONVENTIONS]);
|
|
57
|
-
const EXCLUDE_REGEXP = /node_modules/;
|
|
58
|
-
const ENDING_REGEX = /(?:\.d\.[mc]?tsx?|\.\w+)$/;
|
|
59
|
-
const CHUNKS_PACKEM_FOLDER = "packem_chunks";
|
|
60
|
-
const SHARED_PACKEM_FOLDER = "packem_shared";
|
|
61
|
-
const ALLOWED_TRANSFORM_EXTENSIONS_REGEX = /\.(?:m|c)?(?:j|t)sx?$/;
|
|
62
|
-
|
|
63
|
-
export { ALLOWED_TRANSFORM_EXTENSIONS_REGEX as A, CHUNKS_PACKEM_FOLDER as C, DEFAULT_EXTENSIONS as D, EXCLUDE_REGEXP as E, PRODUCTION_ENV as P, RUNTIME_EXPORT_CONVENTIONS as R, SHARED_PACKEM_FOLDER as S, VALID_EXPORT_EXTENSIONS as V, DEFAULT_LOADERS as a, DEVELOPMENT_ENV as b, SPECIAL_EXPORT_CONVENTIONS as c, ENDING_REGEX as d };
|