Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
perf(core): light entries for safe paths, asset paths and the runtime script (#4642)
Miguel Ángel2449ea05b1d9
diff --git a/packages/core/package-subpaths.json b/packages/core/package-subpaths.jsonindex 870ad5a1cf..ef25941cd6 100644--- a/packages/core/package-subpaths.json+++ b/packages/core/package-subpaths.json@@ -38,6 +38,24 @@"types": "./dist/utils/htmlAttrSafety.d.ts","environments": ["browser", "bun", "node"]},+ "./safe-path": {+ "source": "./src/safePath.ts",+ "runtime": "./dist/safePath.js",+ "types": "./dist/safePath.d.ts",+ "environments": ["bun", "node"]+ },+ "./asset-paths": {+ "source": "./src/compiler/rewriteSubCompPaths.ts",+ "runtime": "./dist/compiler/rewriteSubCompPaths.js",+ "types": "./dist/compiler/rewriteSubCompPaths.d.ts",+ "environments": ["bun", "node"]+ },+ "./runtime-script": {+ "source": "./src/generated/runtime-inline.ts",+ "runtime": "./dist/generated/runtime-inline.js",+ "types": "./dist/generated/runtime-inline.d.ts",+ "environments": ["browser", "bun", "node"]+ },"./rich-text-sanitize": {"source": "./src/utils/richTextSanitize.ts","runtime": "./dist/utils/richTextSanitize.js",diff --git a/packages/core/package.json b/packages/core/package.jsonindex cb5427e6a4..0de3b66914 100644--- a/packages/core/package.json+++ b/packages/core/package.json@@ -52,6 +52,24 @@"import": "./src/utils/htmlAttrSafety.ts","types": "./src/utils/htmlAttrSafety.ts"},+ "./safe-path": {+ "bun": "./src/safePath.ts",+ "node": "./dist/safePath.js",+ "import": "./src/safePath.ts",+ "types": "./src/safePath.ts"+ },+ "./asset-paths": {+ "bun": "./src/compiler/rewriteSubCompPaths.ts",+ "node": "./dist/compiler/rewriteSubCompPaths.js",+ "import": "./src/compiler/rewriteSubCompPaths.ts",+ "types": "./src/compiler/rewriteSubCompPaths.ts"+ },+ "./runtime-script": {+ "bun": "./src/generated/runtime-inline.ts",+ "node": "./dist/generated/runtime-inline.js",+ "import": "./src/generated/runtime-inline.ts",+ "types": "./src/generated/runtime-inline.ts"+ },"./rich-text-sanitize": {"bun": "./src/utils/richTextSanitize.ts","node": "./dist/utils/richTextSanitize.js",@@ -470,6 +488,18 @@"import": "./dist/utils/htmlAttrSafety.js","types": "./dist/utils/htmlAttrSafety.d.ts"},+ "./safe-path": {+ "import": "./dist/safePath.js",+ "types": "./dist/safePath.d.ts"+ },+ "./asset-paths": {+ "import": "./dist/compiler/rewriteSubCompPaths.js",+ "types": "./dist/compiler/rewriteSubCompPaths.d.ts"+ },+ "./runtime-script": {+ "import": "./dist/generated/runtime-inline.js",+ "types": "./dist/generated/runtime-inline.d.ts"+ },"./rich-text-sanitize": {"import": "./dist/utils/richTextSanitize.js","types": "./dist/utils/richTextSanitize.d.ts"diff --git a/packages/core/src/lightEntries.test.ts b/packages/core/src/lightEntries.test.tsnew file mode 100644index 0000000000..c26b52a117--- /dev/null+++ b/packages/core/src/lightEntries.test.ts@@ -0,0 +1,28 @@+// @vitest-environment node+import { readFileSync } from "node:fs";+import { resolve } from "node:path";+import { buildSync } from "esbuild";+import { describe, expect, it } from "vitest";++const packageDir = resolve(import.meta.dirname, "..");+const { subpaths } = JSON.parse(readFileSync(resolve(packageDir, "package-subpaths.json"), "utf8"));+const HEAVY = /[\\/](recast|ast-types|@babel[\\/]parser|acorn|esprima|linkedom|postcss)[\\/]/;++function loadedModules(entry: string): string[] {+ const { metafile } = buildSync({+ entryPoints: [resolve(packageDir, subpaths[entry].source)],+ bundle: true,+ platform: "node",+ format: "esm",+ write: false,+ metafile: true,+ logLevel: "silent",+ });+ return Object.keys(metafile.inputs);+}++describe("entries a host imports for one helper", () => {+ it.each(["./safe-path", "./asset-paths"])("%s loads none of the parsers", (entry) => {+ expect(loadedModules(entry).filter((path) => HEAVY.test(path))).toEqual([]);+ });+});