From 57e59c4bcbdd06477170bc8e51ab02aeda7706b4 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Sun, 3 Nov 2024 14:34:06 -0800 Subject: [PATCH] Improve benchmark setup, consistently rely on publishConfig (#1648) This commit has two related changes: 1. Clean up and document recent changes in the benchmark script. One of these changes is replacing ad-hoc rewrites of package.json files with a firm reliance on the publishConfig field, which should be reliable (since that's what we use when actually publishing). 2. Update all of the package.json files for published packages to have consistent publishConfig fields. This change also removed a bunch of historical cruft from the package.json files, which helped us to support environments during the ecosystem transition to package.json exports fields. --- .github/workflows/perf.yml | 2 - .gitignore | 1 + bin/published-packages.mts | 42 +++++ bin/setup-bench.mjs | 151 ++++++++++-------- bin/tsconfig.json | 3 - .../benchmark-env/package.json | 1 + .../test/chaos-rehydration-test.ts | 3 +- packages/@glimmer/compiler/package.json | 34 ++-- packages/@glimmer/debug-util/package.json | 25 +-- packages/@glimmer/debug/package.json | 24 +-- packages/@glimmer/destroyable/package.json | 27 ++-- packages/@glimmer/encoder/package.json | 29 ++-- packages/@glimmer/global-context/package.json | 29 ++-- packages/@glimmer/interfaces/package.json | 8 +- .../local-debug-babel-plugin/package.json | 2 +- .../@glimmer/local-debug-flags/package.json | 3 +- packages/@glimmer/manager/package.json | 29 ++-- packages/@glimmer/node/package.json | 29 ++-- .../@glimmer/opcode-compiler/package.json | 29 ++-- packages/@glimmer/owner/package.json | 29 ++-- packages/@glimmer/program/package.json | 29 ++-- packages/@glimmer/reference/package.json | 29 ++-- packages/@glimmer/runtime/package.json | 27 ++-- packages/@glimmer/syntax/package.json | 29 ++-- packages/@glimmer/util/package.json | 29 ++-- packages/@glimmer/validator/package.json | 11 +- .../@glimmer/vm-babel-plugins/package.json | 30 ++-- packages/@glimmer/vm/package.json | 29 ++-- packages/@glimmer/wire-format/package.json | 29 ++-- 29 files changed, 413 insertions(+), 329 deletions(-) create mode 100644 bin/published-packages.mts diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 4ad22fd9c..36b5d8a40 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -12,8 +12,6 @@ concurrency: cancel-in-progress: true env: - EXPERIMENT_BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - CONTROL_BRANCH_NAME: 'main' FIDELITY: 100 THROTTLE: 4 FORK_NAME: ${{ github.event.pull_request.head.repo.full_name }} diff --git a/.gitignore b/.gitignore index 529ce4972..4bc81fcb5 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ instrumentation.*.json .cache **/*.tgz tracerbench-results +.rollup.cache diff --git a/bin/published-packages.mts b/bin/published-packages.mts new file mode 100644 index 000000000..ab7d192e4 --- /dev/null +++ b/bin/published-packages.mts @@ -0,0 +1,42 @@ +import { $ } from 'zx'; +import chalk from 'chalk'; +import { packages } from './packages.mjs'; + +/* + Example JSON entry: + + { + name: '@glimmer/validator', + version: '0.92.3', + path: '/home/ykatz/Code/Ember/glimmer-vm/packages/@glimmer/validator', + private: false, + dependencies: { + '@glimmer/env': [Object], + '@glimmer/global-context': [Object], + '@glimmer/interfaces': [Object], + '@glimmer/util': [Object] + }, + devDependencies: { + '@glimmer-workspace/build-support': [Object], + '@glimmer/debug-util': [Object], + '@glimmer/local-debug-flags': [Object], + eslint: [Object], + publint: [Object], + rollup: [Object], + typescript: [Object] + } + } +*/ + +/** + * @typedef {} PackageEntry + */ + +const entries = await packages('@glimmer'); + +const quiet = process.argv.includes('--quiet') || process.argv.includes('-q'); + +for (const entry of entries) { + console.log(entry.name); + if (!quiet) console.error(chalk.gray(` ${entry.path}`)); +} diff --git a/bin/setup-bench.mjs b/bin/setup-bench.mjs index c8fbbaea2..5bc2650d6 100644 --- a/bin/setup-bench.mjs +++ b/bin/setup-bench.mjs @@ -1,10 +1,11 @@ import 'zx/globals'; import os from 'node:os'; import { join } from 'node:path'; -import chalk from 'chalk'; +import { readFile, writeFile } from 'node:fs/promises'; const ROOT = new URL('..', import.meta.url).pathname; $.verbose = true; + const REUSE_CONTROL = !!process.env['REUSE_CONTROL']; /* @@ -56,7 +57,6 @@ const markers = (process.env['MARKERS'] || appMarkers) .join(','); const fidelity = process.env['FIDELITY'] || '20'; const throttleRate = process.env['THROTTLE'] || '2'; -const FORK_NAME = process.env['FORK_NAME'] || ''; const tempDir = os.tmpdir(); @@ -84,8 +84,8 @@ if (!REUSE_CONTROL) { await $`rm -rf ${EXPERIMENT_DIR}`; await $`mkdir ${EXPERIMENT_DIR}`; -const isMacOs = os.platform() === 'darwin'; - +// Intentionally use the same folder for both experiment and control to make it easier to +// make changes to the benchmark suite itself and compare the results. const BENCHMARK_FOLDER = join(pwd, benchmarkFolder); const CONTROL_PORT = 4020; @@ -93,72 +93,42 @@ const EXPERIMENT_PORT = 4021; const CONTROL_URL = `http://localhost:${CONTROL_PORT}`; const EXPERIMENT_URL = `http://localhost:${EXPERIMENT_PORT}`; -// we can't do it in parallel on CI, - -if (!REUSE_CONTROL) { - // setup control - await within(async () => { - await $`git fetch origin`; - const mainRef = await $`git rev-parse origin/main`; - await cd(CONTROL_DIR); - await $`git clone ${join(ROOT, '.git')} .`; - await $`git reset --hard ${mainRef}`; - await $`rm -rf ./benchmark`; - await $`cp -r ${BENCHMARK_FOLDER} ./benchmark`; - - console.info(`$ pnpm install --no-frozen-lockfile ${chalk.gray('[control]')}`); - - await $`pwd`; - const result = await $`pnpm install`; - console.log(result); - - console.info(`$ pnpm build ${chalk.gray('[control]')}`); - - await $`pnpm build`; - - if (isMacOs) { - await $`find ./packages -name 'package.json' -exec sed -i '' 's|"main": "index.ts",|"main": "./dist/prod/index.js","module": "./dist/prod/index.js",|g' {} \\;`; - await $`find ./packages -name 'package.json' -exec sed -i '' 's|"main": "./dist/index.js",|"main": "./dist/prod/index.js","module": "./dist/prod/index.js",|g' {} \\;`; - await $`find ./packages -name 'package.json' -exec sed -i '' 's|"import": "./dist/index.js"|"import": "./dist/prod/index.js"|g' {} \\;`; - } else { - await $`find ./packages -name 'package.json' -exec sed -i 's|"main": "index.ts",|"main": "./dist/prod/index.js","module": "./dist/prod/index.js",|g' {} \\;`; - await $`find ./packages -name 'package.json' -exec sed -i 's|"main": "./dist/index.js",|"main": "./dist/prod/index.js","module": "./dist/prod/index.js",|g' {} \\;`; - await $`find ./packages -name 'package.json' -exec sed -i 's|"import": "./dist/index.js"|"import": "./dist/prod/index.js"|g' {} \\;`; - } +// make sure that the origin is up to date so we get the right control +await $`git fetch origin`; - await cd(CONTROL_BENCH_DIR); - await $`pnpm vite build`; - }); -} +// now we can get the ref of the control branch so we can check it out later +const controlRef = (await $`git rev-parse origin/main`).stdout.trim(); -// setup experiment -await within(async () => { - await cd(EXPERIMENT_DIR); - await $`git clone ${join(ROOT, '.git')} .`; - await $`git checkout --force ${experimentRef}`; - await $`rm -rf ./benchmark`; - await $`cp -r ${BENCHMARK_FOLDER} ./benchmark`; +// we can't do it in parallel on CI, - console.info(`$ pnpm install --no-frozen-lockfile ${chalk.gray('[experiment]')}`); - const install = () => $`pnpm install --no-frozen-lockfile`.pipe(process.stderr); - await spinner(install); - console.info(`$ pnpm build ${chalk.gray('[experiment]')}`); - const build = () => $`pnpm build`.pipe(process.stderr); - await spinner(build); - - if (isMacOs) { - await $`find ./packages -name 'package.json' -exec sed -i '' 's|"main": "index.ts",|"main": "./dist/prod/index.js","module": "./dist/prod/index.js",|g' {} \\;`; - await $`find ./packages -name 'package.json' -exec sed -i '' 's|"main": "./dist/index.js",|"main": "./dist/prod/index.js","module": "./dist/prod/index.js",|g' {} \\;`; - await $`find ./packages -name 'package.json' -exec sed -i '' 's|"import": "./dist/index.js"|"import": "./dist/prod/index.js"|g' {} \\;`; - } else { - await $`find ./packages -name 'package.json' -exec sed -i 's|"main": "index.ts",|"main": "./dist/prod/index.js","module": "./dist/prod/index.js",|g' {} \\;`; - await $`find ./packages -name 'package.json' -exec sed -i 's|"main": "./dist/index.js",|"main": "./dist/prod/index.js","module": "./dist/prod/index.js",|g' {} \\;`; - await $`find ./packages -name 'package.json' -exec sed -i 's|"import": "./dist/index.js"|"import": "./dist/prod/index.js"|g' {} \\;`; +/** + * Rewrite all `package.json`s with a `publishConfig` field with the fields specified in + * `publishConfig`. + */ +async function rewritePackageJson() { + // limit to `@glimmer/*` packages + const packages = await $`find ./packages/@glimmer -name 'package.json'`; + + for (const pkg of packages.stdout.trim().split('\n')) { + const packageJson = JSON.parse(await readFile(pkg, { encoding: 'utf8' })); + const publishConfig = packageJson['publishConfig']; + + // assume that the presence of a `publishConfig` field means that the package is + // a published package and needs its package.json updated to behave like a published + // package in the benchmark environment. + if (publishConfig) { + const updatedPkg = { ...packageJson, ...publishConfig }; + + for (const [key, value] of Object.entries(publishConfig)) { + if (value === null) { + delete updatedPkg[key]; + } + } + + await writeFile(pkg, JSON.stringify(updatedPkg, null, 2), { encoding: 'utf8' }); + } } - - await cd(EXPERIMENT_BENCH_DIR); - await $`pnpm vite build`; -}); +} console.info({ control: controlBranchName, @@ -167,6 +137,18 @@ console.info({ CONTROL_DIR, }); +// setup experiment +await within(async () => { + await buildRepo(EXPERIMENT_DIR, experimentRef); +}); + +if (!REUSE_CONTROL) { + // setup control + await within(async () => { + await buildRepo(CONTROL_DIR, controlRef); + }); +} + // start build assets $`cd ${CONTROL_BENCH_DIR} && pnpm vite preview --port ${CONTROL_PORT}`; $`cd ${EXPERIMENT_BENCH_DIR} && pnpm vite preview --port ${EXPERIMENT_PORT}`; @@ -194,3 +176,40 @@ try { } process.exit(0); + +/** + * @param {string} directory the directory to clone into + * @param {string} ref the ref to checkout + */ +async function buildRepo(directory, ref) { + // the benchmark directory is located in `packages/@glimmer/benchmark` in each of the + // experiment and control checkouts + const benchDir = join(directory, 'benchmark', 'benchmarks', 'krausest'); + + await cd(directory); + + // write the `pwd` to the output to make it easier to debug if something goes wrong + await $`pwd`; + + // clone the raw git repo for the experiment + await $`git clone ${join(ROOT, '.git')} .`; + + // checkout the repo to the HEAD of the current branch + await $`git checkout --force ${ref}`; + + // recreate the benchmark directory + await $`rm -rf ./benchmark`; + // intentionally use the same folder for both experiment and control + await $`cp -r ${BENCHMARK_FOLDER} ./benchmark`; + + // `pnpm install` and build the repo + await $`pnpm install --no-frozen-lockfile`; + await $`pnpm build`; + + // rewrite all `package.json`s to behave like published packages + await rewritePackageJson(); + + // build the benchmarks using vite + await cd(benchDir); + await $`pnpm vite build`; +} diff --git a/bin/tsconfig.json b/bin/tsconfig.json index bb4f82cb0..53b233b27 100644 --- a/bin/tsconfig.json +++ b/bin/tsconfig.json @@ -2,18 +2,15 @@ "compilerOptions": { "composite": true, "skipLibCheck": true, - "baseUrl": ".", "allowJs": true, "checkJs": true, "outDir": "../ts-dist/bin", - "target": "es2020", "module": "esnext", "moduleResolution": "bundler", "allowSyntheticDefaultImports": true, "verbatimModuleSyntax": true, - "strict": true, "suppressImplicitAnyIndexErrors": false, "useDefineForClassFields": false, diff --git a/packages/@glimmer-workspace/benchmark-env/package.json b/packages/@glimmer-workspace/benchmark-env/package.json index 1a46900fa..bb8493074 100644 --- a/packages/@glimmer-workspace/benchmark-env/package.json +++ b/packages/@glimmer-workspace/benchmark-env/package.json @@ -3,6 +3,7 @@ "version": "0.84.3", "private": true, "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer-workspace/benchmark-env", + "type": "module", "main": "index.ts", "scripts": { "test:lint": "eslint .", diff --git a/packages/@glimmer-workspace/integration-tests/test/chaos-rehydration-test.ts b/packages/@glimmer-workspace/integration-tests/test/chaos-rehydration-test.ts index 3e1fa0087..6586bc952 100644 --- a/packages/@glimmer-workspace/integration-tests/test/chaos-rehydration-test.ts +++ b/packages/@glimmer-workspace/integration-tests/test/chaos-rehydration-test.ts @@ -89,11 +89,10 @@ abstract class AbstractChaosMonkeyTest extends RenderTest { let removedNodeDisplay: Nullable; switch (nodeToRemove.nodeType) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison case COMMENT_NODE: removedNodeDisplay = ``; break; - // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison + case ELEMENT_NODE: removedNodeDisplay = castToBrowser(nodeToRemove, ['HTML', 'SVG']).outerHTML; break; diff --git a/packages/@glimmer/compiler/package.json b/packages/@glimmer/compiler/package.json index b917d89c6..be44f9b15 100644 --- a/packages/@glimmer/compiler/package.json +++ b/packages/@glimmer/compiler/package.json @@ -4,29 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/compiler", "type": "module", - "main": "index.ts", - "types": "index.ts", - "exports": { - "types": "./index.ts", - "development": "./index.ts", - "import": "./dist/index.js" - }, + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/debug-util/package.json b/packages/@glimmer/debug-util/package.json index 3c67ef45d..2e20fff93 100644 --- a/packages/@glimmer/debug-util/package.json +++ b/packages/@glimmer/debug-util/package.json @@ -6,32 +6,9 @@ "description": "Common utilities used in Glimmer with debug-specific behavior", "repository": "https://github.com/tildeio/glimmer/tree/main/packages/@glimmer/debug-util", "type": "module", - "main": "index.ts", - "types": "index.ts", - "publishConfig": { - "access": "public", - "types": "dist/dev/index.d.ts", - "exports": { - ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" - }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" - } - }, - "main": null, - "module": "dist/dev/index.js" - }, - "files": [ - "dist" - ], + "exports": "./index.ts", "scripts": { - "build": "rollup -c rollup.config.mjs", "test:lint": "eslint .", - "test:publint": "publint", "test:types": "tsc --noEmit -p ../tsconfig.json" }, "dependencies": { diff --git a/packages/@glimmer/debug/package.json b/packages/@glimmer/debug/package.json index 2e36fc78d..04cec452e 100644 --- a/packages/@glimmer/debug/package.json +++ b/packages/@glimmer/debug/package.json @@ -7,29 +7,7 @@ "sideEffects": false, "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/debug", "type": "module", - "main": "index.ts", - "types": "index.ts", - "exports": { - "types": "./index.ts", - "development": "./index.ts" - }, - "publishConfig": { - "access": "public", - "types": "dist/dev/index.d.ts", - "exports": { - ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "import": "./dist/dev/index.js" - } - } - }, - "main": null, - "module": "dist/dev/index.js" - }, - "files": [ - "dist" - ], + "exports": "./index.ts", "scripts": { "test:lint": "eslint .", "test:types": "tsc --noEmit -p ../tsconfig.json" diff --git a/packages/@glimmer/destroyable/package.json b/packages/@glimmer/destroyable/package.json index 395740197..c002ff5ea 100644 --- a/packages/@glimmer/destroyable/package.json +++ b/packages/@glimmer/destroyable/package.json @@ -5,22 +5,29 @@ "description": "Utilities for creating and managing a destroyable hierarchy of objects", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/destroyable", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/encoder/package.json b/packages/@glimmer/encoder/package.json index 36e059064..166a89208 100644 --- a/packages/@glimmer/encoder/package.json +++ b/packages/@glimmer/encoder/package.json @@ -4,24 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/encoder", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/global-context/package.json b/packages/@glimmer/global-context/package.json index 982374355..29b6cd443 100644 --- a/packages/@glimmer/global-context/package.json +++ b/packages/@glimmer/global-context/package.json @@ -4,24 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/global-context", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "./dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/interfaces/package.json b/packages/@glimmer/interfaces/package.json index 7e9288b89..93c4c57b1 100644 --- a/packages/@glimmer/interfaces/package.json +++ b/packages/@glimmer/interfaces/package.json @@ -4,13 +4,7 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/interfaces", "type": "module", - "types": "index.d.ts", - "exports": { - "types": "./index.d.ts" - }, - "publishConfig": { - "access": "public" - }, + "exports": "./index.d.ts", "files": [ "lib", "index.d.ts" diff --git a/packages/@glimmer/local-debug-babel-plugin/package.json b/packages/@glimmer/local-debug-babel-plugin/package.json index c595d3a68..a95d97ba5 100644 --- a/packages/@glimmer/local-debug-babel-plugin/package.json +++ b/packages/@glimmer/local-debug-babel-plugin/package.json @@ -9,5 +9,5 @@ }, "type": "module", "private": true, - "main": "index.js" + "exports": "./index.js" } diff --git a/packages/@glimmer/local-debug-flags/package.json b/packages/@glimmer/local-debug-flags/package.json index d7b379243..cb1486fd0 100644 --- a/packages/@glimmer/local-debug-flags/package.json +++ b/packages/@glimmer/local-debug-flags/package.json @@ -10,8 +10,7 @@ }, "type": "module", "private": true, - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "scripts": { "test:lint": "eslint .", "test:types": "tsc --noEmit -p ../tsconfig.json" diff --git a/packages/@glimmer/manager/package.json b/packages/@glimmer/manager/package.json index 101453310..50e0a2059 100644 --- a/packages/@glimmer/manager/package.json +++ b/packages/@glimmer/manager/package.json @@ -4,24 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/program", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/node/package.json b/packages/@glimmer/node/package.json index bd76171d7..8c02c45ea 100644 --- a/packages/@glimmer/node/package.json +++ b/packages/@glimmer/node/package.json @@ -4,24 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/node", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/opcode-compiler/package.json b/packages/@glimmer/opcode-compiler/package.json index 1ef4fc219..e4d54e7b7 100644 --- a/packages/@glimmer/opcode-compiler/package.json +++ b/packages/@glimmer/opcode-compiler/package.json @@ -4,24 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/opcode-compiler", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/owner/package.json b/packages/@glimmer/owner/package.json index c828e6922..182b8d4bd 100644 --- a/packages/@glimmer/owner/package.json +++ b/packages/@glimmer/owner/package.json @@ -5,24 +5,29 @@ "description": "Implementation for the owner in Glimmer apps", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/owner", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/program/package.json b/packages/@glimmer/program/package.json index d01b85707..e48b5df0b 100644 --- a/packages/@glimmer/program/package.json +++ b/packages/@glimmer/program/package.json @@ -4,24 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/program", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/reference/package.json b/packages/@glimmer/reference/package.json index 926ecdbb1..fc3b687ef 100644 --- a/packages/@glimmer/reference/package.json +++ b/packages/@glimmer/reference/package.json @@ -9,24 +9,29 @@ "directory": "packages/@glimmer/reference" }, "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/runtime/package.json b/packages/@glimmer/runtime/package.json index 9907cf207..195836418 100644 --- a/packages/@glimmer/runtime/package.json +++ b/packages/@glimmer/runtime/package.json @@ -5,22 +5,29 @@ "description": "Minimal runtime needed to render Glimmer templates", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/runtime", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/syntax/package.json b/packages/@glimmer/syntax/package.json index 619a909ad..f9bbbf17e 100644 --- a/packages/@glimmer/syntax/package.json +++ b/packages/@glimmer/syntax/package.json @@ -4,24 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/syntax", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/util/package.json b/packages/@glimmer/util/package.json index 3ff7a8075..544683ad3 100644 --- a/packages/@glimmer/util/package.json +++ b/packages/@glimmer/util/package.json @@ -5,24 +5,29 @@ "description": "Common utilities used in Glimmer", "repository": "https://github.com/tildeio/glimmer/tree/main/packages/@glimmer/util", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/validator/package.json b/packages/@glimmer/validator/package.json index b91f61529..7412ea069 100644 --- a/packages/@glimmer/validator/package.json +++ b/packages/@glimmer/validator/package.json @@ -9,11 +9,12 @@ "directory": "packages/@glimmer/validator" }, "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": { + "types": "./index.ts", + "development": "./index.ts" + }, "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { "types": "./dist/dev/index.d.ts", @@ -24,9 +25,7 @@ "require": "./dist/dev/index.cjs", "import": "./dist/prod/index.js" } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/vm-babel-plugins/package.json b/packages/@glimmer/vm-babel-plugins/package.json index 57cb0f719..a1c29a32c 100644 --- a/packages/@glimmer/vm-babel-plugins/package.json +++ b/packages/@glimmer/vm-babel-plugins/package.json @@ -5,25 +5,31 @@ "description": "Compiles out VM assertion and deprecation utilities and debug tooling based on environment", "repository": "https://github.com/glimmerjs/glimmer.js", "author": "Tom Dale ", - "type": "module", "private": false, - "main": "index.ts", - "types": "index.ts", + "type": "module", + "exports": "./index.ts", "publishConfig": { "access": "public", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/vm/package.json b/packages/@glimmer/vm/package.json index f97a70df7..49e049caa 100644 --- a/packages/@glimmer/vm/package.json +++ b/packages/@glimmer/vm/package.json @@ -4,24 +4,29 @@ "license": "MIT", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/vm", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist" diff --git a/packages/@glimmer/wire-format/package.json b/packages/@glimmer/wire-format/package.json index 0551e7618..cdd56902c 100644 --- a/packages/@glimmer/wire-format/package.json +++ b/packages/@glimmer/wire-format/package.json @@ -5,24 +5,29 @@ "description": "", "repository": "https://github.com/glimmerjs/glimmer-vm/tree/main/packages/@glimmer/wire-format", "type": "module", - "main": "index.ts", - "types": "index.ts", + "exports": "./index.ts", "publishConfig": { "access": "public", - "types": "dist/dev/index.d.ts", "exports": { ".": { - "types": "./dist/dev/index.d.ts", - "development": { - "require": "./dist/dev/index.cjs", - "import": "./dist/dev/index.js" + "require": { + "development": { + "types": "./dist/dev/index.d.cts", + "default": "./dist/dev/index.cjs" + } }, - "require": "./dist/dev/index.cjs", - "import": "./dist/prod/index.js" + "default": { + "development": { + "types": "./dist/dev/index.d.ts", + "default": "./dist/dev/index.js" + }, + "default": { + "types": "./dist/prod/index.d.ts", + "default": "./dist/prod/index.js" + } + } } - }, - "main": null, - "module": "dist/dev/index.js" + } }, "files": [ "dist"