@markless/bundler 0.8.0 → 0.10.0
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/dist/build-worker.d.ts +1 -0
- package/dist/build-worker.js +59 -0
- package/dist/chunk-ast-C8zKZiam.js +1 -0
- package/dist/chunk-ast-pN_P5wIo.js +204 -0
- package/dist/chunk-tasks-BexSGNjx.js +1 -0
- package/dist/compile-store-DxF9Vj4_.js +187 -0
- package/dist/{execution-log-BL-7a77M.d.ts → execution-log-7HH5XDfA.d.ts} +2 -2
- package/dist/lazy-module-facades-qZajWDD8.js +2691 -0
- package/dist/planned-landing-BHy22Yf5.js +2291 -0
- package/dist/preload.d.ts +2 -2
- package/dist/preload.js +2 -2
- package/dist/{rolldown-BMQrr9-Y.js → rolldown-DS8OY1i9.js} +801 -4406
- package/dist/rolldown.d.ts +3 -3
- package/dist/rolldown.js +3 -2
- package/dist/{roster-resume-CpphsFl_.js → roster-resume-DXptD6DG.js} +2 -1
- package/dist/{route-pack-groups-BLS6xeVV.js → route-pack-groups-ByQmKKom.js} +892 -1004
- package/dist/{types-iOUoceJ-.d.ts → types-B8YqEscg.d.ts} +55 -2
- package/dist/vite.d.ts +6 -1
- package/dist/vite.js +798 -26
- package/package.json +6 -5
- package/dist/optimized-deps-BfzxSm6C.js +0 -89
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markless/bundler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Markless build plugins for Rolldown and Vite.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,12 +39,13 @@
|
|
|
39
39
|
"@thi.ng/dgraph": "^2.1.213",
|
|
40
40
|
"pathe": "^2.0.3",
|
|
41
41
|
"ufo": "^1.6.4",
|
|
42
|
-
"
|
|
43
|
-
"@markless/
|
|
44
|
-
"@markless/
|
|
42
|
+
"yuku": "0.20.1",
|
|
43
|
+
"@markless/compiler": "0.10.0",
|
|
44
|
+
"@markless/web": "0.10.0",
|
|
45
|
+
"@markless/serializer": "0.10.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@markless/analyzer": "0.
|
|
48
|
+
"@markless/analyzer": "0.10.0"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
51
|
"rolldown": "1.2.14",
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
2
|
-
import { dirname, isAbsolute, join, normalize, resolve } from "pathe";
|
|
3
|
-
//#region src/optimized-deps.ts
|
|
4
|
-
function optimizedDepsToInclude(specifiers, resolution) {
|
|
5
|
-
const root = resolve(resolution.root ?? "");
|
|
6
|
-
const preserveSymlinks = resolution.resolve?.preserveSymlinks === true;
|
|
7
|
-
const alias = resolution.resolve?.alias;
|
|
8
|
-
return specifiers.filter((specifier) => !servedFromSource(applyAlias(specifier, alias), root, preserveSymlinks));
|
|
9
|
-
}
|
|
10
|
-
function includeOptimizedDeps(config, specifiers) {
|
|
11
|
-
const bundled = optimizedDepsToInclude(specifiers, config);
|
|
12
|
-
if (bundled.length === 0) return;
|
|
13
|
-
const optimizeDeps = config.optimizeDeps ??= {};
|
|
14
|
-
const include = optimizeDeps.include ?? [];
|
|
15
|
-
optimizeDeps.include = [...include, ...bundled.filter((specifier) => !include.includes(specifier))];
|
|
16
|
-
}
|
|
17
|
-
function excludeSourceShippedDeps(config) {
|
|
18
|
-
const appManifest = nearestManifest(resolve(config.root ?? ""));
|
|
19
|
-
if (!appManifest) return;
|
|
20
|
-
const shipsSource = [];
|
|
21
|
-
const seen = /* @__PURE__ */ new Set();
|
|
22
|
-
const visit = (names, from) => {
|
|
23
|
-
for (const name of names) {
|
|
24
|
-
const directory = installedPackage(name, from);
|
|
25
|
-
if (directory === void 0 || seen.has(directory)) continue;
|
|
26
|
-
seen.add(directory);
|
|
27
|
-
const manifest = readManifest(join(directory, "package.json"));
|
|
28
|
-
if (manifest?.publishConfig?.marklessShipsSource !== true) continue;
|
|
29
|
-
if (!shipsSource.includes(name)) shipsSource.push(name);
|
|
30
|
-
visit(Object.keys(manifest.dependencies ?? {}), realpathOf(directory));
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
visit([...Object.keys(appManifest.manifest.dependencies ?? {}), ...Object.keys(appManifest.manifest.devDependencies ?? {})], appManifest.directory);
|
|
34
|
-
if (shipsSource.length === 0) return;
|
|
35
|
-
const optimizeDeps = config.optimizeDeps ??= {};
|
|
36
|
-
const exclude = optimizeDeps.exclude ?? [];
|
|
37
|
-
optimizeDeps.exclude = [...exclude, ...shipsSource.filter((name) => !exclude.includes(name))];
|
|
38
|
-
}
|
|
39
|
-
function readManifest(path) {
|
|
40
|
-
try {
|
|
41
|
-
return JSON.parse(readFileSync(path, "utf8"));
|
|
42
|
-
} catch {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function nearestManifest(root) {
|
|
47
|
-
for (let directory = root;; directory = dirname(directory)) {
|
|
48
|
-
const manifest = existsSync(join(directory, "package.json")) ? readManifest(join(directory, "package.json")) : void 0;
|
|
49
|
-
if (manifest) return {
|
|
50
|
-
directory,
|
|
51
|
-
manifest
|
|
52
|
-
};
|
|
53
|
-
if (dirname(directory) === directory) return void 0;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function applyAlias(specifier, alias) {
|
|
57
|
-
if (!alias) return specifier;
|
|
58
|
-
const entries = Array.isArray(alias) ? alias : Object.entries(alias).map(([find, replacement]) => ({
|
|
59
|
-
find,
|
|
60
|
-
replacement
|
|
61
|
-
}));
|
|
62
|
-
for (const { find, replacement } of entries) if (typeof find === "string") {
|
|
63
|
-
if (specifier === find || specifier.startsWith(`${find}/`)) return replacement + specifier.slice(find.length);
|
|
64
|
-
} else if (find.test(specifier)) return specifier.replace(find, replacement);
|
|
65
|
-
return specifier;
|
|
66
|
-
}
|
|
67
|
-
function servedFromSource(id, root, preserveSymlinks) {
|
|
68
|
-
const path = isAbsolute(id) || id.startsWith(".") ? resolve(root, id) : installedPackage(id, root);
|
|
69
|
-
if (path === void 0) return false;
|
|
70
|
-
return !`${preserveSymlinks ? normalize(path) : realpathOf(path)}/`.includes("/node_modules/");
|
|
71
|
-
}
|
|
72
|
-
function installedPackage(specifier, root) {
|
|
73
|
-
const segments = specifier.split("/");
|
|
74
|
-
const name = specifier.startsWith("@") ? segments.slice(0, 2).join("/") : segments[0];
|
|
75
|
-
for (let directory = root;; directory = dirname(directory)) {
|
|
76
|
-
const entry = join(directory, "node_modules", name);
|
|
77
|
-
if (existsSync(entry)) return entry;
|
|
78
|
-
if (dirname(directory) === directory) return void 0;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function realpathOf(path) {
|
|
82
|
-
try {
|
|
83
|
-
return normalize(realpathSync(path));
|
|
84
|
-
} catch {
|
|
85
|
-
return normalize(path);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
export { includeOptimizedDeps as n, optimizedDepsToInclude as r, excludeSourceShippedDeps as t };
|