Every emitted JavaScript map ships beside the bundle it describes, and the workspace build and the client preset compress bundles without mangling identifiers. The documentation payload now mirrors the website publication manifest and is removed again by `postpack`; Desktop and the Python executable exclude the published source, documentation, and maps; `clean` removes a staged copy. Typert's publication contract gains the Remote declaration map.
51 lines
2.7 KiB
TypeScript
51 lines
2.7 KiB
TypeScript
/** Desktop-only omissions from already installed production npm packages. */
|
|
|
|
/**
|
|
* Identify build and diagnostic files omitted from the immutable Desktop runtime.
|
|
* Unrecognized assets and target runtime binaries are retained. Paths name the copied
|
|
* node_modules tree, including nested package containers.
|
|
* @param path - Path relative to the production node_modules directory.
|
|
* @param target - Platform and architecture of the Electron Node runtime.
|
|
* @param officeEngine - Engine selected from the installed kit manifest.
|
|
* @returns Omission reason, or undefined when the entry must be copied.
|
|
*/
|
|
export function desktopRuntimeFileExclusion(
|
|
path: string, target: { platform: NodeJS.Platform; arch: string }, officeEngine: string,
|
|
): string | undefined {
|
|
const parts = path.split(/[\\/]/u)
|
|
if (parts.some(part => ['.bin', '.pnpm', '.modules.yaml', '.pnpm-workspace-state-v1.json'].includes(part))) {
|
|
return 'package-manager metadata'
|
|
}
|
|
const file = parts.at(-1) ?? ''
|
|
if (/\.(?:[cm]?[jt]s|css)\.map$/u.test(file)) return 'source map'
|
|
if (/\.d\.[cm]?ts$/u.test(file)) return 'TypeScript declaration'
|
|
if (/\.tsbuildinfo$/u.test(file)) return 'TypeScript build cache'
|
|
const packageParts = parts.slice(parts.lastIndexOf('node_modules') + 1)
|
|
const nameParts = packageParts[0]?.startsWith('@') ? 2 : 1
|
|
const name = packageParts.slice(0, nameParts).join('/')
|
|
const entry = packageParts.slice(nameParts).join('/')
|
|
if (name.startsWith('@deepseek-ai/dsh') && (entry === 'src' || entry.startsWith('src/'))) {
|
|
return 'published source'
|
|
}
|
|
if (name === '@deepseek-ai/dsh' && (entry === 'docs' || entry.startsWith('docs/'))) {
|
|
return 'published documentation'
|
|
}
|
|
if (name.startsWith('@deepseek-ai/libreoffice-kit-')) {
|
|
if (name !== `@deepseek-ai/libreoffice-kit-${officeEngine}`) return 'LibreOffice other platform'
|
|
}
|
|
if (name === 'fs-ext' && /^build\/(?:Release|Debug)\/(?:obj(?:\/|$)|fs_ext\.(?:exp|lib|pdb|iobj|ipdb)$)/u.test(entry)) {
|
|
return 'fs-ext compiler output'
|
|
}
|
|
if (name === 'fs-ext' && /^build\/(?:binding\.sln|config\.gypi|fs_ext\.vcxproj(?:\.filters)?)$/u.test(entry)) {
|
|
return 'fs-ext build configuration'
|
|
}
|
|
if (name === '@mixmark-io/domino' && (entry === 'test' || entry.startsWith('test/'))) return 'Domino test fixtures'
|
|
if (name === 'node-pty' && entry.startsWith('prebuilds/')) {
|
|
const platform = packageParts[nameParts + 1]
|
|
if (platform !== undefined && platform !== `${target.platform}-${target.arch}`) return 'node-pty other platform'
|
|
if (file.endsWith('.pdb')) return 'node-pty debug symbols'
|
|
}
|
|
if (name === '@koromix/koffi-win32-x64' && entry === 'win32_x64/koffi.lib') return 'Koffi import library'
|
|
return undefined
|
|
}
|