@fastkit/plugboy 1.0.0-next.4 → 1.0.0-next.5
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/README.md +28 -21
- package/dist/cli.mjs +3 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/{combine-rules-CWp-M491.mjs → combine-rules-DKihHyJd.mjs} +3 -4
- package/dist/{combine-rules-CWp-M491.mjs.map → combine-rules-DKihHyJd.mjs.map} +1 -1
- package/dist/dependencies/bundle-require.mjs +2 -3
- package/dist/dependencies/cac.mjs +2 -3
- package/dist/dependencies/glob.mjs +2 -3
- package/dist/dependencies/inquirer.mjs +2 -3
- package/dist/dependencies/pkg-types.mjs +2 -3
- package/dist/dependencies/sort-package-json.mjs +1 -2
- package/dist/dependencies/sort-package-json.mjs.map +1 -1
- package/dist/dependencies/tsdown.mjs +2 -3
- package/dist/{optimize-layer-CK8NR_VC.mjs → optimize-layer-DZdbIjXg.mjs} +3 -4
- package/dist/{optimize-layer-CK8NR_VC.mjs.map → optimize-layer-DZdbIjXg.mjs.map} +1 -1
- package/dist/{optimize-media-Bxy27Cj7.mjs → optimize-media-CocGC9bo.mjs} +3 -4
- package/dist/{optimize-media-Bxy27Cj7.mjs.map → optimize-media-CocGC9bo.mjs.map} +1 -1
- package/dist/plugboy.d.mts +6 -5464
- package/dist/plugboy.mjs +2 -3
- package/dist/runtime-utils.mjs +1 -2
- package/dist/runtime-utils.mjs.map +1 -1
- package/dist/{workspace-Den7m7D_.mjs → workspace-VIdL5Yhp.mjs} +20 -46
- package/dist/workspace-VIdL5Yhp.mjs.map +1 -0
- package/package.json +12 -10
- package/dist/workspace-Den7m7D_.mjs.map +0 -1
package/dist/plugboy.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { $ as normalizeDTSSettings, A as resolveRawExposeEntriesSettings, B as exitHook, C as findProjectPlugin, D as loadProjectConfig, E as isProjectPackageJson, F as getFilename, G as resolveListable, H as mergeExternals, I as isFileNotFoundException, J as WORKSPACE_REQUIRED_FIELDS, K as PROJECT_REQUIRED_FIELDS, L as pathExists, M as findConfig, N as findFile, O as resolveUserProjectConfig, P as getDirname, Q as normalizeDTSPreserveTypeTarget, R as rmrf, S as extractProjectPlugins, T as defineProjectConfig, U as mergeNoExternals, V as mergeChunkAddons, W as isPromise, X as mergeDTSSettingsList, Y as resolveOptimizeCSSOptions, Z as normalizeDTSPreserveTypeSettings, _ as loadWorkspaceConfig, a as syncWorkspacePackageFields, b as resolveUserWorkspaceConfig, c as Builder, d as getWorkspacePackageJson, et as createHooksDefaults, f as Path, g as isWorkspacePackageJson, h as defineWorkspaceConfig, i as getWorkspace, j as copyDirSync, k as exposeEntries, l as findWorkspacePackages, m as resolveUserHooks, n as PlugboyWorkspace, o as PlugboyProject, p as buildHooks, q as TSDOWN_SYNC_OPTIONS, r as WORKSPACE_PACKAGE_SYNC_FIELDS, s as getProject, t as generateWorkspace, u as getProjectPackageJson, v as resolveRawWorkspaceEntries, w as resolveUserPluginOption, x as definePlugin, y as resolveRawWorkspaceEntry, z as writeFileAtomic } from "./workspace-
|
|
2
|
-
|
|
3
|
-
export { Builder, PROJECT_REQUIRED_FIELDS, Path, PlugboyProject, PlugboyWorkspace, TSDOWN_SYNC_OPTIONS, WORKSPACE_PACKAGE_SYNC_FIELDS, WORKSPACE_REQUIRED_FIELDS, buildHooks, copyDirSync, createHooksDefaults, definePlugin, defineProjectConfig, defineWorkspaceConfig, exitHook, exposeEntries, extractProjectPlugins, findConfig, findFile, findProjectPlugin, findWorkspacePackages, generateWorkspace, getDirname, getFilename, getProject, getProjectPackageJson, getWorkspace, getWorkspacePackageJson, isFileNotFoundException, isProjectPackageJson, isPromise, isWorkspacePackageJson, loadProjectConfig, loadWorkspaceConfig, mergeChunkAddons, mergeDTSSettingsList, mergeExternals, mergeNoExternals, normalizeDTSPreserveTypeSettings, normalizeDTSPreserveTypeTarget, normalizeDTSSettings, pathExists, resolveListable, resolveOptimizeCSSOptions, resolveRawExposeEntriesSettings, resolveRawWorkspaceEntries, resolveRawWorkspaceEntry, resolveUserHooks, resolveUserPluginOption, resolveUserProjectConfig, resolveUserWorkspaceConfig, rmrf, syncWorkspacePackageFields, writeFileAtomic };
|
|
1
|
+
import { $ as normalizeDTSSettings, A as resolveRawExposeEntriesSettings, B as exitHook, C as findProjectPlugin, D as loadProjectConfig, E as isProjectPackageJson, F as getFilename, G as resolveListable, H as mergeExternals, I as isFileNotFoundException, J as WORKSPACE_REQUIRED_FIELDS, K as PROJECT_REQUIRED_FIELDS, L as pathExists, M as findConfig, N as findFile, O as resolveUserProjectConfig, P as getDirname, Q as normalizeDTSPreserveTypeTarget, R as rmrf, S as extractProjectPlugins, T as defineProjectConfig, U as mergeNoExternals, V as mergeChunkAddons, W as isPromise, X as mergeDTSSettingsList, Y as resolveOptimizeCSSOptions, Z as normalizeDTSPreserveTypeSettings, _ as loadWorkspaceConfig, a as syncWorkspacePackageFields, b as resolveUserWorkspaceConfig, c as Builder, d as getWorkspacePackageJson, et as createHooksDefaults, f as Path, g as isWorkspacePackageJson, h as defineWorkspaceConfig, i as getWorkspace, j as copyDirSync, k as exposeEntries, l as findWorkspacePackages, m as resolveUserHooks, n as PlugboyWorkspace, o as PlugboyProject, p as buildHooks, q as TSDOWN_SYNC_OPTIONS, r as WORKSPACE_PACKAGE_SYNC_FIELDS, s as getProject, t as generateWorkspace, u as getProjectPackageJson, v as resolveRawWorkspaceEntries, w as resolveUserPluginOption, x as definePlugin, y as resolveRawWorkspaceEntry, z as writeFileAtomic } from "./workspace-VIdL5Yhp.mjs";
|
|
2
|
+
export { Builder, PROJECT_REQUIRED_FIELDS, Path, PlugboyProject, PlugboyWorkspace, TSDOWN_SYNC_OPTIONS, WORKSPACE_PACKAGE_SYNC_FIELDS, WORKSPACE_REQUIRED_FIELDS, buildHooks, copyDirSync, createHooksDefaults, definePlugin, defineProjectConfig, defineWorkspaceConfig, exitHook, exposeEntries, extractProjectPlugins, findConfig, findFile, findProjectPlugin, findWorkspacePackages, generateWorkspace, getDirname, getFilename, getProject, getProjectPackageJson, getWorkspace, getWorkspacePackageJson, isFileNotFoundException, isProjectPackageJson, isPromise, isWorkspacePackageJson, loadProjectConfig, loadWorkspaceConfig, mergeChunkAddons, mergeDTSSettingsList, mergeExternals, mergeNoExternals, normalizeDTSPreserveTypeSettings, normalizeDTSPreserveTypeTarget, normalizeDTSSettings, pathExists, resolveListable, resolveOptimizeCSSOptions, resolveRawExposeEntriesSettings, resolveRawWorkspaceEntries, resolveRawWorkspaceEntry, resolveUserHooks, resolveUserPluginOption, resolveUserProjectConfig, resolveUserWorkspaceConfig, rmrf, syncWorkspacePackageFields, writeFileAtomic };
|
package/dist/runtime-utils.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { dirname, join } from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { stat } from "node:fs/promises";
|
|
4
|
-
|
|
5
4
|
//#region src/runtime-utils/path.ts
|
|
6
5
|
/**
|
|
7
6
|
* Universal ESM function to get the file path of the caller.
|
|
@@ -88,7 +87,7 @@ async function getPackageDir(callerFilePath = getCallerFilePath()) {
|
|
|
88
87
|
}
|
|
89
88
|
throw new Error(`package.json not found for: ${callerFilePath}`);
|
|
90
89
|
}
|
|
91
|
-
|
|
92
90
|
//#endregion
|
|
93
91
|
export { getCallerFile, getCallerFilePath, getPackageDir };
|
|
92
|
+
|
|
94
93
|
//# sourceMappingURL=runtime-utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-utils.mjs","names":[],"sources":["../src/runtime-utils/path.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Universal ESM function to get the file path of the caller.\n * Works in Node.js, Deno, and Bun (native ESM environments).\n *\n * - Uses V8 structured stack traces when available (Node/Bun).\n * - Falls back to string-based stack parsing when necessary (e.g., Deno).\n * - Throws a descriptive error when the file path cannot be determined.\n */\n\nclass CallerFileError extends Error {\n info: unknown;\n constructor(message: string, info: unknown = {}) {\n super(message);\n this.name = 'CallerFileError';\n this.info = info;\n }\n}\n\n/**\n * Returns the absolute file path of the calling file.\n *\n * @param {number} depth - 1 = immediate caller, 2 = caller's caller, etc.\n * @returns {string} Absolute file path of the caller.\n * @throws {CallerFileError} If the caller file cannot be determined.\n */\nexport function getCallerFile(depth = 1) {\n if (typeof depth !== 'number' || depth < 1) {\n throw new CallerFileError('Invalid depth argument', { depth });\n }\n\n // --- Primary method: V8 structured stack trace (Node.js / Bun) ---\n try {\n const originalPrepare = Error.prepareStackTrace;\n Error.prepareStackTrace = (_, structuredStackTrace) => structuredStackTrace;\n const err = new Error();\n const { stack } = err;\n Error.prepareStackTrace = originalPrepare;\n\n if (Array.isArray(stack)) {\n const frame = stack[depth];\n if (frame && typeof frame.getFileName === 'function') {\n const file = frame.getFileName();\n if (typeof file === 'string') return file;\n throw new CallerFileError('CallSite#getFileName() returned null', {\n frame,\n });\n } else {\n throw new CallerFileError('Invalid or missing CallSite object', {\n frame,\n });\n }\n } else {\n throw new CallerFileError('Structured stack trace unavailable', {\n stack,\n });\n }\n } catch (v8Error) {\n // --- Fallback: plain text stack parsing (Deno and others) ---\n try {\n const stackStr = new Error().stack;\n if (typeof stackStr !== 'string') {\n throw new CallerFileError('Error.stack is not a string', {\n stack: stackStr,\n });\n }\n\n const lines = stackStr\n .split('\\n')\n .map((l) => l.trim())\n .filter(Boolean);\n const index = 1 + depth;\n if (index >= lines.length) {\n throw new CallerFileError('Stack trace too shallow', { lines });\n }\n\n const line = lines[index];\n\n // Match file URLs or absolute paths\n const match =\n line.match(/(file:\\/\\/[^\\s)]+)/) ||\n line.match(/(\\/[^:\\s)]+)(:\\d+){0,2}/) ||\n line.match(/([A-Za-z]:\\\\[^:\\s)]+)(:\\d+){0,2}/);\n\n if (!match) {\n throw new CallerFileError('No file path pattern found in stack line', {\n line,\n });\n }\n\n const raw = match[1];\n if (raw.startsWith('file://')) {\n const url = new URL(raw);\n return url.pathname;\n }\n\n return raw.replace(/:\\d+(:\\d+)?$/, '');\n } catch (fallbackError) {\n if (fallbackError instanceof CallerFileError) throw fallbackError;\n throw new CallerFileError('Fallback stack parsing failed', {\n cause: fallbackError,\n });\n }\n }\n}\n\n/**\n * Returns the absolute file path of the calling file.\n *\n * @param {number} depth - 1 = immediate caller, 2 = caller's caller, etc.\n * @returns {string} Absolute file path of the caller.\n * @throws {CallerFileError} If the caller file cannot be determined.\n */\nexport function getCallerFilePath(depth = 1) {\n const file = getCallerFile(depth + 1);\n return file.startsWith('file:') ? fileURLToPath(file) : file;\n}\n\n/**\n * Returns the directory that contains the package.json\n * associated with the specified import.meta.url.\n *\n * If no package.json is found while walking up the directory tree,\n * an error will be thrown.\n */\nexport async function getPackageDir(\n callerFilePath = getCallerFilePath(),\n): Promise<string> {\n // const { stat } = await import('node:fs/promises');\n // const { join, dirname } = await import('node:path');\n // const { fileURLToPath } = await import('node:url');\n\n let dir = dirname(callerFilePath);\n\n while (true) {\n const pkgJson = join(dir, 'package.json');\n\n const exists = await stat(pkgJson)\n .then(() => true)\n .catch(() => false);\n if (exists) return dir;\n\n // Move to the parent directory\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n throw new Error(`package.json not found for: ${callerFilePath}`);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-utils.mjs","names":[],"sources":["../src/runtime-utils/path.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Universal ESM function to get the file path of the caller.\n * Works in Node.js, Deno, and Bun (native ESM environments).\n *\n * - Uses V8 structured stack traces when available (Node/Bun).\n * - Falls back to string-based stack parsing when necessary (e.g., Deno).\n * - Throws a descriptive error when the file path cannot be determined.\n */\n\nclass CallerFileError extends Error {\n info: unknown;\n constructor(message: string, info: unknown = {}) {\n super(message);\n this.name = 'CallerFileError';\n this.info = info;\n }\n}\n\n/**\n * Returns the absolute file path of the calling file.\n *\n * @param {number} depth - 1 = immediate caller, 2 = caller's caller, etc.\n * @returns {string} Absolute file path of the caller.\n * @throws {CallerFileError} If the caller file cannot be determined.\n */\nexport function getCallerFile(depth = 1) {\n if (typeof depth !== 'number' || depth < 1) {\n throw new CallerFileError('Invalid depth argument', { depth });\n }\n\n // --- Primary method: V8 structured stack trace (Node.js / Bun) ---\n try {\n const originalPrepare = Error.prepareStackTrace;\n Error.prepareStackTrace = (_, structuredStackTrace) => structuredStackTrace;\n const err = new Error();\n const { stack } = err;\n Error.prepareStackTrace = originalPrepare;\n\n if (Array.isArray(stack)) {\n const frame = stack[depth];\n if (frame && typeof frame.getFileName === 'function') {\n const file = frame.getFileName();\n if (typeof file === 'string') return file;\n throw new CallerFileError('CallSite#getFileName() returned null', {\n frame,\n });\n } else {\n throw new CallerFileError('Invalid or missing CallSite object', {\n frame,\n });\n }\n } else {\n throw new CallerFileError('Structured stack trace unavailable', {\n stack,\n });\n }\n } catch (v8Error) {\n // --- Fallback: plain text stack parsing (Deno and others) ---\n try {\n const stackStr = new Error().stack;\n if (typeof stackStr !== 'string') {\n throw new CallerFileError('Error.stack is not a string', {\n stack: stackStr,\n });\n }\n\n const lines = stackStr\n .split('\\n')\n .map((l) => l.trim())\n .filter(Boolean);\n const index = 1 + depth;\n if (index >= lines.length) {\n throw new CallerFileError('Stack trace too shallow', { lines });\n }\n\n const line = lines[index];\n\n // Match file URLs or absolute paths\n const match =\n line.match(/(file:\\/\\/[^\\s)]+)/) ||\n line.match(/(\\/[^:\\s)]+)(:\\d+){0,2}/) ||\n line.match(/([A-Za-z]:\\\\[^:\\s)]+)(:\\d+){0,2}/);\n\n if (!match) {\n throw new CallerFileError('No file path pattern found in stack line', {\n line,\n });\n }\n\n const raw = match[1];\n if (raw.startsWith('file://')) {\n const url = new URL(raw);\n return url.pathname;\n }\n\n return raw.replace(/:\\d+(:\\d+)?$/, '');\n } catch (fallbackError) {\n if (fallbackError instanceof CallerFileError) throw fallbackError;\n throw new CallerFileError('Fallback stack parsing failed', {\n cause: fallbackError,\n });\n }\n }\n}\n\n/**\n * Returns the absolute file path of the calling file.\n *\n * @param {number} depth - 1 = immediate caller, 2 = caller's caller, etc.\n * @returns {string} Absolute file path of the caller.\n * @throws {CallerFileError} If the caller file cannot be determined.\n */\nexport function getCallerFilePath(depth = 1) {\n const file = getCallerFile(depth + 1);\n return file.startsWith('file:') ? fileURLToPath(file) : file;\n}\n\n/**\n * Returns the directory that contains the package.json\n * associated with the specified import.meta.url.\n *\n * If no package.json is found while walking up the directory tree,\n * an error will be thrown.\n */\nexport async function getPackageDir(\n callerFilePath = getCallerFilePath(),\n): Promise<string> {\n // const { stat } = await import('node:fs/promises');\n // const { join, dirname } = await import('node:path');\n // const { fileURLToPath } = await import('node:url');\n\n let dir = dirname(callerFilePath);\n\n while (true) {\n const pkgJson = join(dir, 'package.json');\n\n const exists = await stat(pkgJson)\n .then(() => true)\n .catch(() => false);\n if (exists) return dir;\n\n // Move to the parent directory\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n throw new Error(`package.json not found for: ${callerFilePath}`);\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAM,kBAAN,cAA8B,MAAM;CAClC;CACA,YAAY,SAAiB,OAAgB,CAAC,GAAG;EAC/C,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;;;;;;;;AASA,SAAgB,cAAc,QAAQ,GAAG;CACvC,IAAI,OAAO,UAAU,YAAY,QAAQ,GACvC,MAAM,IAAI,gBAAgB,0BAA0B,EAAE,MAAM,CAAC;CAI/D,IAAI;EACF,MAAM,kBAAkB,MAAM;EAC9B,MAAM,qBAAqB,GAAG,yBAAyB;EAEvD,MAAM,EAAE,0BAAU,IADF,MACI;EACpB,MAAM,oBAAoB;EAE1B,IAAI,MAAM,QAAQ,KAAK,GAAG;GACxB,MAAM,QAAQ,MAAM;GACpB,IAAI,SAAS,OAAO,MAAM,gBAAgB,YAAY;IACpD,MAAM,OAAO,MAAM,YAAY;IAC/B,IAAI,OAAO,SAAS,UAAU,OAAO;IACrC,MAAM,IAAI,gBAAgB,wCAAwC,EAChE,MACF,CAAC;GACH,OACE,MAAM,IAAI,gBAAgB,sCAAsC,EAC9D,MACF,CAAC;EAEL,OACE,MAAM,IAAI,gBAAgB,sCAAsC,EAC9D,MACF,CAAC;CAEL,SAAS,SAAS;EAEhB,IAAI;GACF,MAAM,4BAAW,IAAI,MAAM,EAAA,CAAE;GAC7B,IAAI,OAAO,aAAa,UACtB,MAAM,IAAI,gBAAgB,+BAA+B,EACvD,OAAO,SACT,CAAC;GAGH,MAAM,QAAQ,SACX,MAAM,IAAI,CAAC,CACX,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,CACpB,OAAO,OAAO;GACjB,MAAM,QAAQ,IAAI;GAClB,IAAI,SAAS,MAAM,QACjB,MAAM,IAAI,gBAAgB,2BAA2B,EAAE,MAAM,CAAC;GAGhE,MAAM,OAAO,MAAM;GAGnB,MAAM,QACJ,KAAK,MAAM,oBAAoB,KAC/B,KAAK,MAAM,yBAAyB,KACpC,KAAK,MAAM,kCAAkC;GAE/C,IAAI,CAAC,OACH,MAAM,IAAI,gBAAgB,4CAA4C,EACpE,KACF,CAAC;GAGH,MAAM,MAAM,MAAM;GAClB,IAAI,IAAI,WAAW,SAAS,GAE1B,OAAO,IADS,IAAI,GACX,CAAC,CAAC;GAGb,OAAO,IAAI,QAAQ,gBAAgB,EAAE;EACvC,SAAS,eAAe;GACtB,IAAI,yBAAyB,iBAAiB,MAAM;GACpD,MAAM,IAAI,gBAAgB,iCAAiC,EACzD,OAAO,cACT,CAAC;EACH;CACF;AACF;;;;;;;;AASA,SAAgB,kBAAkB,QAAQ,GAAG;CAC3C,MAAM,OAAO,cAAc,QAAQ,CAAC;CACpC,OAAO,KAAK,WAAW,OAAO,IAAI,cAAc,IAAI,IAAI;AAC1D;;;;;;;;AASA,eAAsB,cACpB,iBAAiB,kBAAkB,GAClB;CAKjB,IAAI,MAAM,QAAQ,cAAc;CAEhC,OAAO,MAAM;EAMX,IAAI,MAHiB,KAFL,KAAK,KAAK,cAEM,CAAC,CAAC,CAC/B,WAAW,IAAI,CAAC,CAChB,YAAY,KAAK,GACR,OAAO;EAGnB,MAAM,SAAS,QAAQ,GAAG;EAC1B,IAAI,WAAW,KAAK;EACpB,MAAM;CACR;CAEA,MAAM,IAAI,MAAM,+BAA+B,gBAAgB;AACjE"}
|
|
@@ -9,7 +9,6 @@ import { execa } from "execa";
|
|
|
9
9
|
import { parse } from "acorn";
|
|
10
10
|
import sortPackageJson from "sort-package-json";
|
|
11
11
|
import * as prompts from "@inquirer/prompts";
|
|
12
|
-
|
|
13
12
|
//#region src/types/hook.ts
|
|
14
13
|
function createHooksDefaults() {
|
|
15
14
|
return {
|
|
@@ -18,7 +17,6 @@ function createHooksDefaults() {
|
|
|
18
17
|
preparePackageJSON: []
|
|
19
18
|
};
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
//#endregion
|
|
23
21
|
//#region src/types/dts.ts
|
|
24
22
|
function normalizeDTSPreserveTypeTarget(target) {
|
|
@@ -61,7 +59,6 @@ function mergeDTSSettingsList(...settingsList) {
|
|
|
61
59
|
});
|
|
62
60
|
return normalizeDTSSettings(merged);
|
|
63
61
|
}
|
|
64
|
-
|
|
65
62
|
//#endregion
|
|
66
63
|
//#region src/types/css.ts
|
|
67
64
|
function resolveOptimizeCSSOptions(options) {
|
|
@@ -73,23 +70,19 @@ function resolveOptimizeCSSOptions(options) {
|
|
|
73
70
|
if (cssnano !== false) resolved.cssnano = cssnano === true ? { preset: ["default", { normalizeWhitespace: false }] } : cssnano;
|
|
74
71
|
return resolved;
|
|
75
72
|
}
|
|
76
|
-
|
|
77
73
|
//#endregion
|
|
78
74
|
//#region src/types/workspace.ts
|
|
79
75
|
const WORKSPACE_REQUIRED_FIELDS = ["name", "version"];
|
|
80
76
|
const TSDOWN_SYNC_OPTIONS = [
|
|
81
77
|
"define",
|
|
82
|
-
"noExternal",
|
|
83
|
-
"external",
|
|
84
78
|
"skipNodeModulesBundle",
|
|
85
79
|
"onSuccess",
|
|
86
|
-
"copy"
|
|
80
|
+
"copy",
|
|
81
|
+
"deps"
|
|
87
82
|
];
|
|
88
|
-
|
|
89
83
|
//#endregion
|
|
90
84
|
//#region src/types/project.ts
|
|
91
85
|
const PROJECT_REQUIRED_FIELDS = ["name"];
|
|
92
|
-
|
|
93
86
|
//#endregion
|
|
94
87
|
//#region src/utils/general.ts
|
|
95
88
|
function isPromise(obj) {
|
|
@@ -109,7 +102,6 @@ async function resolveListable(raw) {
|
|
|
109
102
|
}
|
|
110
103
|
return result;
|
|
111
104
|
}
|
|
112
|
-
|
|
113
105
|
//#endregion
|
|
114
106
|
//#region src/utils/tsdown.ts
|
|
115
107
|
const _stringChunkToObject = (source) => {
|
|
@@ -183,7 +175,6 @@ function mergeNoExternals(base, override) {
|
|
|
183
175
|
});
|
|
184
176
|
};
|
|
185
177
|
}
|
|
186
|
-
|
|
187
178
|
//#endregion
|
|
188
179
|
//#region src/utils/exit-hook.ts
|
|
189
180
|
const EXIT_SIGNALS = [
|
|
@@ -211,7 +202,6 @@ for (const signal of EXIT_SIGNALS) process.on(signal, async () => {
|
|
|
211
202
|
process.exit(1);
|
|
212
203
|
}
|
|
213
204
|
});
|
|
214
|
-
|
|
215
205
|
//#endregion
|
|
216
206
|
//#region src/utils/file.ts
|
|
217
207
|
function getFilename(importMetaURL) {
|
|
@@ -338,7 +328,6 @@ async function writeFileAtomic(filePath, content) {
|
|
|
338
328
|
throw error;
|
|
339
329
|
}
|
|
340
330
|
}
|
|
341
|
-
|
|
342
331
|
//#endregion
|
|
343
332
|
//#region src/utils/expose.ts
|
|
344
333
|
function resolveRawExposeEntriesSettings(rawSettings) {
|
|
@@ -358,7 +347,6 @@ async function exposeEntries(rawSettings) {
|
|
|
358
347
|
}
|
|
359
348
|
return entries;
|
|
360
349
|
}
|
|
361
|
-
|
|
362
350
|
//#endregion
|
|
363
351
|
//#region src/constants.ts
|
|
364
352
|
const PROJECT_CONFIG_BASENAME = "plugboy.project";
|
|
@@ -366,7 +354,6 @@ const WORKSPACE_CONFIG_BASENAME = "plugboy.workspace";
|
|
|
366
354
|
const PACKAGE_JSON_FILENAME = "package.json";
|
|
367
355
|
const WORKSPACE_SPEC_PREFIX = "workspace:";
|
|
368
356
|
const SEARCH_BUNDLE_EXTENSIONS_MATCH = "(ts|mjs|js|json)";
|
|
369
|
-
|
|
370
357
|
//#endregion
|
|
371
358
|
//#region src/utils/project.ts
|
|
372
359
|
function isProjectPackageJson(json) {
|
|
@@ -399,7 +386,6 @@ async function loadProjectConfig(searchDir, depth) {
|
|
|
399
386
|
}, searchDir);
|
|
400
387
|
return resolveUserProjectConfig(await (hit ? (await bundleRequire({ filepath: hit.path })).mod.default : {}));
|
|
401
388
|
}
|
|
402
|
-
|
|
403
389
|
//#endregion
|
|
404
390
|
//#region src/utils/plugin.ts
|
|
405
391
|
async function resolveUserPluginOption(pluginOption) {
|
|
@@ -419,7 +405,6 @@ async function extractProjectPlugins(searchDir) {
|
|
|
419
405
|
async function findProjectPlugin(pluginName, searchDir) {
|
|
420
406
|
return (await extractProjectPlugins(searchDir)).find((plugin) => plugin.name === pluginName);
|
|
421
407
|
}
|
|
422
|
-
|
|
423
408
|
//#endregion
|
|
424
409
|
//#region src/utils/workspace.ts
|
|
425
410
|
function isWorkspacePackageJson(json) {
|
|
@@ -458,7 +443,6 @@ async function loadWorkspaceConfig(searchDir, depth) {
|
|
|
458
443
|
}, searchDir);
|
|
459
444
|
return resolveUserWorkspaceConfig(await (hit ? (await bundleRequire({ filepath: hit.path })).mod.default : {}));
|
|
460
445
|
}
|
|
461
|
-
|
|
462
446
|
//#endregion
|
|
463
447
|
//#region src/utils/hook.ts
|
|
464
448
|
async function resolveUserHooks(...userHooks) {
|
|
@@ -481,7 +465,6 @@ function buildHooks(resolvedHooks) {
|
|
|
481
465
|
});
|
|
482
466
|
return hooks;
|
|
483
467
|
}
|
|
484
|
-
|
|
485
468
|
//#endregion
|
|
486
469
|
//#region src/path.ts
|
|
487
470
|
var Path = class Path {
|
|
@@ -568,7 +551,6 @@ var Path = class Path {
|
|
|
568
551
|
}
|
|
569
552
|
}
|
|
570
553
|
};
|
|
571
|
-
|
|
572
554
|
//#endregion
|
|
573
555
|
//#region src/package.ts
|
|
574
556
|
async function getProjectPackageJson(searchDir, allowMissing) {
|
|
@@ -610,7 +592,6 @@ async function findWorkspacePackages(dir) {
|
|
|
610
592
|
});
|
|
611
593
|
return results;
|
|
612
594
|
}
|
|
613
|
-
|
|
614
595
|
//#endregion
|
|
615
596
|
//#region src/workspace/dts.ts
|
|
616
597
|
async function runTsc(compiler, opts = {}, ignoreErrors) {
|
|
@@ -643,7 +624,6 @@ async function emitDTS(opts) {
|
|
|
643
624
|
});
|
|
644
625
|
else await runTsc(compiler, { ...baseOpts }, ignoreCompilerErrors);
|
|
645
626
|
}
|
|
646
|
-
|
|
647
627
|
//#endregion
|
|
648
628
|
//#region src/env/constants.ts
|
|
649
629
|
const PLUGBOY_VAR_ENVS_FOR_BUNDLE = {
|
|
@@ -654,7 +634,6 @@ const PLUGBOY_VAR_ENVS_FOR_STUB = {
|
|
|
654
634
|
__PLUGBOY_STUB__: "true",
|
|
655
635
|
__PLUGBOY_DEV__: "true"
|
|
656
636
|
};
|
|
657
|
-
|
|
658
637
|
//#endregion
|
|
659
638
|
//#region src/env/utils.ts
|
|
660
639
|
function applyPlugboyEnvs(config) {
|
|
@@ -669,7 +648,6 @@ function applyPlugboyEnvs(config) {
|
|
|
669
648
|
function getPlugboyEnvCodeForStub() {
|
|
670
649
|
return Object.entries(PLUGBOY_VAR_ENVS_FOR_STUB).map(([envName, variable]) => `globalThis.${envName} = ${variable};`).join("\n");
|
|
671
650
|
}
|
|
672
|
-
|
|
673
651
|
//#endregion
|
|
674
652
|
//#region src/env/plugin.ts
|
|
675
653
|
function findAfterImports(code) {
|
|
@@ -710,7 +688,6 @@ function WorkspaceEnvPlugin(_workspace) {
|
|
|
710
688
|
}
|
|
711
689
|
};
|
|
712
690
|
}
|
|
713
|
-
|
|
714
691
|
//#endregion
|
|
715
692
|
//#region src/workspace/builder.ts
|
|
716
693
|
const SHEBANG_MATCH_RE = /^(#!.+?)\n/;
|
|
@@ -727,10 +704,10 @@ var Builder = class {
|
|
|
727
704
|
this.workspace = workspace;
|
|
728
705
|
}
|
|
729
706
|
async tsdownOptions(overrides) {
|
|
730
|
-
|
|
707
|
+
const { _tsdownOptions } = this;
|
|
731
708
|
if (_tsdownOptions) return _tsdownOptions;
|
|
732
709
|
const { entry, dts } = this;
|
|
733
|
-
|
|
710
|
+
const resolvedOptions = {
|
|
734
711
|
dts: dts.inline || typeof dts.compiler === "function" ? false : dts.compiler === "vue-tsc" ? { vue: true } : true,
|
|
735
712
|
treeshake: true,
|
|
736
713
|
css: this.workspace.cssOptions,
|
|
@@ -740,11 +717,12 @@ var Builder = class {
|
|
|
740
717
|
clean: true,
|
|
741
718
|
...overrides
|
|
742
719
|
};
|
|
743
|
-
for (const opt of TSDOWN_SYNC_OPTIONS)
|
|
744
|
-
applyPlugboyEnvs(
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
720
|
+
for (const opt of TSDOWN_SYNC_OPTIONS) resolvedOptions[opt] = this.workspace.config[opt];
|
|
721
|
+
applyPlugboyEnvs(resolvedOptions);
|
|
722
|
+
resolvedOptions.deps ??= {};
|
|
723
|
+
resolvedOptions.deps.neverBundle = mergeExternals(resolvedOptions.deps.neverBundle, [/^(@fastkit\/)?plugboy(?!\/runtime-utils)/, ...this.workspace.dependencies]);
|
|
724
|
+
this._tsdownOptions = resolvedOptions;
|
|
725
|
+
return resolvedOptions;
|
|
748
726
|
}
|
|
749
727
|
async _stubLinkJS(from, to) {
|
|
750
728
|
const fromParsed = path.parse(from);
|
|
@@ -884,7 +862,6 @@ var Builder = class {
|
|
|
884
862
|
else await this.normalizeDTSFiles();
|
|
885
863
|
}
|
|
886
864
|
};
|
|
887
|
-
|
|
888
865
|
//#endregion
|
|
889
866
|
//#region src/project/project.ts
|
|
890
867
|
/**
|
|
@@ -964,16 +941,15 @@ async function getProject(searchDir, allowMissing, skipLoadConfig) {
|
|
|
964
941
|
resolvedWorkspaces
|
|
965
942
|
});
|
|
966
943
|
}
|
|
967
|
-
|
|
968
944
|
//#endregion
|
|
969
945
|
//#region src/postcss/plugin.ts
|
|
970
946
|
async function getPostcss(options) {
|
|
971
947
|
const { layer, media, combineRules, cssnano } = options;
|
|
972
948
|
const [postcss, _layer, _media, _combineRules, _cssnano] = await Promise.all([
|
|
973
949
|
import("postcss").then((mod) => mod.default),
|
|
974
|
-
layer && import("./optimize-layer-
|
|
975
|
-
media && import("./optimize-media-
|
|
976
|
-
combineRules && import("./combine-rules-
|
|
950
|
+
layer && import("./optimize-layer-DZdbIjXg.mjs").then((mod) => mod.OptimizeLayer(layer)),
|
|
951
|
+
media && import("./optimize-media-CocGC9bo.mjs").then((mod) => mod.OptimizeMedia(media)),
|
|
952
|
+
combineRules && import("./combine-rules-DKihHyJd.mjs").then((mod) => mod.CombineRules(combineRules)),
|
|
977
953
|
cssnano && import("cssnano").then((mod) => mod.default(cssnano))
|
|
978
954
|
]);
|
|
979
955
|
const plugins = [];
|
|
@@ -1019,7 +995,6 @@ function OptimizeCSSPlugin(workspace) {
|
|
|
1019
995
|
}
|
|
1020
996
|
};
|
|
1021
997
|
}
|
|
1022
|
-
|
|
1023
998
|
//#endregion
|
|
1024
999
|
//#region src/workspace/plugins/raw-loader.ts
|
|
1025
1000
|
const rawLoaderPlugin = {
|
|
@@ -1041,7 +1016,6 @@ const rawLoaderPlugin = {
|
|
|
1041
1016
|
return `export default ${JSON.stringify(content)};`;
|
|
1042
1017
|
}
|
|
1043
1018
|
};
|
|
1044
|
-
|
|
1045
1019
|
//#endregion
|
|
1046
1020
|
//#region src/workspace/plugins/preserve-css-imports.ts
|
|
1047
1021
|
/**
|
|
@@ -1105,7 +1079,6 @@ function createPreserveCssImportsPlugin() {
|
|
|
1105
1079
|
} }
|
|
1106
1080
|
});
|
|
1107
1081
|
}
|
|
1108
|
-
|
|
1109
1082
|
//#endregion
|
|
1110
1083
|
//#region src/workspace/workspace.ts
|
|
1111
1084
|
function extractWorkspaceObjectExport(at) {
|
|
@@ -1264,7 +1237,7 @@ var PlugboyWorkspace = class {
|
|
|
1264
1237
|
const deps = cloned[prop];
|
|
1265
1238
|
if (!deps) return;
|
|
1266
1239
|
Object.keys(deps).forEach((dep) => {
|
|
1267
|
-
if (deps[dep].startsWith(
|
|
1240
|
+
if (deps[dep].startsWith("workspace:")) deps[dep] = `${WORKSPACE_SPEC_PREFIX}^`;
|
|
1268
1241
|
else if (projectPeerDependencies && projectPeerDependencies[dep] && !deps[dep]) deps[dep] = projectPeerDependencies[dep];
|
|
1269
1242
|
});
|
|
1270
1243
|
});
|
|
@@ -1345,10 +1318,12 @@ async function getWorkspace(searchDir, allowMissing) {
|
|
|
1345
1318
|
css: config.css,
|
|
1346
1319
|
optimizeCSS,
|
|
1347
1320
|
mergeExternals: (override) => {
|
|
1348
|
-
config.
|
|
1321
|
+
config.deps ??= {};
|
|
1322
|
+
config.deps.neverBundle = mergeExternals(config.deps.neverBundle, override);
|
|
1349
1323
|
},
|
|
1350
1324
|
mergeNoExternals: (override) => {
|
|
1351
|
-
config.
|
|
1325
|
+
config.deps ??= {};
|
|
1326
|
+
config.deps.alwaysBundle = mergeNoExternals(config.deps.alwaysBundle, override);
|
|
1352
1327
|
}
|
|
1353
1328
|
};
|
|
1354
1329
|
await hooks.setupWorkspace(ctx, () => {
|
|
@@ -1358,7 +1333,6 @@ async function getWorkspace(searchDir, allowMissing) {
|
|
|
1358
1333
|
await hooks.createWorkspace(workspace);
|
|
1359
1334
|
return workspace;
|
|
1360
1335
|
}
|
|
1361
|
-
|
|
1362
1336
|
//#endregion
|
|
1363
1337
|
//#region src/workspace/generate.ts
|
|
1364
1338
|
async function generateWorkspace(workspaceName, cwd = process.cwd()) {
|
|
@@ -1477,7 +1451,7 @@ export default defineWorkspaceConfig({
|
|
|
1477
1451
|
await (await getWorkspace(workspaceDir)).preparePackageJSON();
|
|
1478
1452
|
}
|
|
1479
1453
|
}
|
|
1480
|
-
|
|
1481
1454
|
//#endregion
|
|
1482
1455
|
export { normalizeDTSSettings as $, resolveRawExposeEntriesSettings as A, exitHook as B, findProjectPlugin as C, loadProjectConfig as D, isProjectPackageJson as E, getFilename as F, resolveListable as G, mergeExternals as H, isFileNotFoundException as I, WORKSPACE_REQUIRED_FIELDS as J, PROJECT_REQUIRED_FIELDS as K, pathExists as L, findConfig as M, findFile as N, resolveUserProjectConfig as O, getDirname as P, normalizeDTSPreserveTypeTarget as Q, rmrf as R, extractProjectPlugins as S, defineProjectConfig as T, mergeNoExternals as U, mergeChunkAddons as V, isPromise as W, mergeDTSSettingsList as X, resolveOptimizeCSSOptions as Y, normalizeDTSPreserveTypeSettings as Z, loadWorkspaceConfig as _, syncWorkspacePackageFields as a, resolveUserWorkspaceConfig as b, Builder as c, getWorkspacePackageJson as d, createHooksDefaults as et, Path as f, isWorkspacePackageJson as g, defineWorkspaceConfig as h, getWorkspace as i, copyDirSync as j, exposeEntries as k, findWorkspacePackages as l, resolveUserHooks as m, PlugboyWorkspace as n, PlugboyProject as o, buildHooks as p, TSDOWN_SYNC_OPTIONS as q, WORKSPACE_PACKAGE_SYNC_FIELDS as r, getProject as s, generateWorkspace as t, getProjectPackageJson as u, resolveRawWorkspaceEntries as v, resolveUserPluginOption as w, definePlugin as x, resolveRawWorkspaceEntry as y, writeFileAtomic as z };
|
|
1483
|
-
|
|
1456
|
+
|
|
1457
|
+
//# sourceMappingURL=workspace-VIdL5Yhp.mjs.map
|