From 3e079d5260abcc4eaa61a5780110445ccc4b94e9 Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 6 Jun 2024 09:27:13 -0700 Subject: [PATCH] Add liveDev feature Fix: https://github.com/isaacs/tshy/issues/63 --- README.md | 23 + src/build-live-commonjs.ts | 43 + src/build-live-esm.ts | 41 + src/build.ts | 13 +- src/config.ts | 3 +- src/exports.ts | 57 +- src/types.ts | 1 + .../test/build-live-commonjs.ts.test.cjs | 16 + tap-snapshots/test/build-live-esm.ts.test.cjs | 16 + tap-snapshots/test/build.ts.test.cjs | 7336 +++++++++++------ tap-snapshots/test/exports.ts.test.cjs | 150 + test/build-live-commonjs.ts | 34 + test/build-live-esm.ts | 34 + test/build.ts | 48 + test/exports.ts | 120 + 15 files changed, 5384 insertions(+), 2551 deletions(-) create mode 100644 src/build-live-commonjs.ts create mode 100644 src/build-live-esm.ts create mode 100644 tap-snapshots/test/build-live-commonjs.ts.test.cjs create mode 100644 tap-snapshots/test/build-live-esm.ts.test.cjs create mode 100644 test/build-live-commonjs.ts create mode 100644 test/build-live-esm.ts diff --git a/README.md b/README.md index bed8c78..012f8e0 100644 --- a/README.md +++ b/README.md @@ -381,6 +381,29 @@ This would export a file at `./src/foo.ts` as `./foo`, and a file at `./src/utils/bar.ts` as `./utils/bar`, but would ignore a file at `./internal/private.ts`. +### Live Dev + +Set `"liveDev": true` in the tshy config in `package.json` to +build in link mode. In this mode, the files are hard-linked into +place in the `dist` folder, so that edits are immediately visible. + +This is particularly beneficial in monorepo projects, where +workspaces may be edited in parallel, and so it's handy to have +changes reflected in real time without a rebuild. + +Of course, tools that can't handle TypeScript will have a problem +with this, so any generic `node` program will not be able to run +your code. For this reason: + +- `liveDev` is always disabled when the `npm_command` environment + variable is `'publish'` or `'pack'`. In these situations, your + code is being built for public consumption, and must be + compiled. +- Code in dist will not be able to be loaded in the node repl + unless you run it with a loader, such as `node --import=tsx`. +- Because it links files into place, a rebuild _is_ required when + a file is added or removed. + ### Package `#imports` You can use `"imports"` in your package.json, and it will be diff --git a/src/build-live-commonjs.ts b/src/build-live-commonjs.ts new file mode 100644 index 0000000..53c6ce9 --- /dev/null +++ b/src/build-live-commonjs.ts @@ -0,0 +1,43 @@ +import chalk from 'chalk' +import { linkSync, mkdirSync } from 'node:fs' +import { dirname } from 'node:path' +import { relative, resolve } from 'node:path/posix' +import config from './config.js' +import * as console from './console.js' +import ifExist from './if-exist.js' +import polyfills from './polyfills.js' +import setFolderDialect from './set-folder-dialect.js' +import sources from './sources.js' +import './tsconfig.js' + +const { commonjsDialects = [] } = config + +// don't actually do a build, just link files into places. +export const buildLiveCommonJS = () => { + for (const d of ['commonjs', ...commonjsDialects]) { + const pf = polyfills.get(d === 'commonjs' ? 'cjs' : d) + console.debug(chalk.cyan.dim('linking ' + d)) + for (const s of sources) { + const source = s.substring('./src/'.length) + const target = resolve(`.tshy-build/${d}/${source}`) + mkdirSync(dirname(target), { recursive: true }) + linkSync(s, target) + } + setFolderDialect('.tshy-build/' + d, 'commonjs') + for (const [override, orig] of pf?.map.entries() ?? []) { + const stemFrom = resolve( + `.tshy-build/${d}`, + relative(resolve('src'), resolve(override)) + ).replace(/\.cts$/, '') + const stemTo = resolve( + `.tshy-build/${d}`, + relative(resolve('src'), resolve(orig)) + ).replace(/\.tsx?$/, '') + ifExist.unlink(`${stemTo}.js.map`) + ifExist.unlink(`${stemTo}.d.ts.map`) + ifExist.rename(`${stemFrom}.cjs`, `${stemTo}.js`) + ifExist.rename(`${stemFrom}.d.cts`, `${stemTo}.d.ts`) + } + console.error(chalk.cyan.bold('linked commonjs')) + } +} diff --git a/src/build-live-esm.ts b/src/build-live-esm.ts new file mode 100644 index 0000000..a6e51c5 --- /dev/null +++ b/src/build-live-esm.ts @@ -0,0 +1,41 @@ +import chalk from 'chalk' +import { linkSync, mkdirSync } from 'node:fs' +import { dirname, relative, resolve } from 'node:path' +import config from './config.js' +import * as console from './console.js' +import ifExist from './if-exist.js' +import polyfills from './polyfills.js' +import setFolderDialect from './set-folder-dialect.js' +import sources from './sources.js' +import './tsconfig.js' + +const { esmDialects = [] } = config + +export const buildLiveESM = () => { + for (const d of ['esm', ...esmDialects]) { + const pf = polyfills.get(d) + console.debug(chalk.cyan.dim('linking ' + d)) + for (const s of sources) { + const source = s.substring('./src/'.length) + const target = resolve(`.tshy-build/${d}/${source}`) + mkdirSync(dirname(target), { recursive: true }) + linkSync(s, target) + } + setFolderDialect('.tshy-build/' + d, 'esm') + for (const [override, orig] of pf?.map.entries() ?? []) { + const stemFrom = resolve( + `.tshy-build/${d}`, + relative(resolve('src'), resolve(override)) + ).replace(/\.mts$/, '') + const stemTo = resolve( + `.tshy-build/${d}`, + relative(resolve('src'), resolve(orig)) + ).replace(/\.tsx?$/, '') + ifExist.unlink(`${stemTo}.js.map`) + ifExist.unlink(`${stemTo}.d.ts.map`) + ifExist.rename(`${stemFrom}.mjs`, `${stemTo}.js`) + ifExist.rename(`${stemFrom}.d.mts`, `${stemTo}.d.ts`) + } + console.error(chalk.cyan.bold('linked ' + d)) + } +} diff --git a/src/build.ts b/src/build.ts index a655aca..82bdad3 100644 --- a/src/build.ts +++ b/src/build.ts @@ -1,4 +1,5 @@ import chalk from 'chalk' +import config from './config.js' import { syncContentSync } from 'sync-content' import bins from './bins.js' import { buildCommonJS } from './build-commonjs.js' @@ -18,14 +19,22 @@ import { unlink as unlinkImports, } from './unbuilt-imports.js' import writePackage from './write-package.js' +import { buildLiveESM } from './build-live-esm.js' +import { buildLiveCommonJS } from './build-live-commonjs.js' export default async () => { cleanBuildTmp() linkSelfDep(pkg, 'src') await linkImports(pkg, 'src') - if (dialects.includes('esm')) buildESM() - if (dialects.includes('commonjs')) buildCommonJS() + const liveDev = + config.liveDev && + process.env.npm_command !== 'publish' && + process.env.npm_command !== 'pack' + const esm = liveDev ? buildLiveESM : buildESM + const commonjs = liveDev ? buildLiveCommonJS : buildCommonJS + if (dialects.includes('esm')) esm() + if (dialects.includes('commonjs')) commonjs() await unlinkImports(pkg, 'src') unlinkSelfDep(pkg, 'src') diff --git a/src/config.ts b/src/config.ts index 8ce34fd..a964482 100644 --- a/src/config.ts +++ b/src/config.ts @@ -40,7 +40,8 @@ const validConfig = (e: any): e is TshyConfigMaybeGlobExports => (e.exclude === undefined || validExclude(e.exclude)) && validExtraDialects(e) && validBoolean(e, 'selfLink') && - validBoolean(e, 'main') + validBoolean(e, 'main') && + validBoolean(e, 'liveDev') const match = (e: string, pattern: Minimatch[]): boolean => pattern.some(m => m.match(e)) diff --git a/src/exports.ts b/src/exports.ts index a06c7d3..1ab7ada 100644 --- a/src/exports.ts +++ b/src/exports.ts @@ -14,6 +14,11 @@ import { resolveExport } from './resolve-export.js' import { Package, TshyConfig, TshyExport } from './types.js' const { esmDialects = [], commonjsDialects = [] } = config +const liveDev = + config.liveDev && + process.env.npm_command !== 'publish' && + process.env.npm_command !== 'pack' + const getTargetForDialectCondition = ( s: string | TshyExport | undefined | null, dialect: T, @@ -35,13 +40,17 @@ const getTargetForDialectCondition = ( const xts = type === 'commonjs' ? '.mts' : '.cts' if (s.endsWith(xts)) return undefined const pf = dialect === 'commonjs' ? 'cjs' : dialect + const rel = relative( + resolve('./src'), + resolve(polyfills.get(pf)?.map.get(s) ?? s) + ) + const target = liveDev + ? rel + : rel.replace(/\.([mc]?)tsx?$/, '.$1js') return !s || !s.startsWith('./src/') ? s : dialects.includes(type) - ? `./dist/${dialect}/${relative( - resolve('./src'), - resolve(polyfills.get(pf)?.map.get(s) ?? s) - ).replace(/\.([mc]?)tsx?$/, '.$1js')}` + ? `./dist/${dialect}/${target}` : undefined } return resolveExport(s, [condition]) @@ -106,10 +115,12 @@ const getExports = ( polyfills ) if (target) { - exp[d] = { - types: target.replace(/\.js$/, '.d.ts'), - default: target, - } + exp[d] = liveDev + ? target + : { + types: target.replace(/\.js$/, '.d.ts'), + default: target, + } } } } @@ -124,25 +135,31 @@ const getExports = ( polyfills ) if (target) { - exp[d] = { - types: target.replace(/\.js$/, '.d.ts'), - default: target, - } + exp[d] = liveDev + ? target + : { + types: target.replace(/\.js$/, '.d.ts'), + default: target, + } } } } // put the default import/require after all the other special ones. if (impTarget) { - exp.import = { - types: impTarget.replace(/\.(m?)js$/, '.d.$1ts'), - default: impTarget, - } + exp.import = liveDev + ? impTarget + : { + types: impTarget.replace(/\.(m?)js$/, '.d.$1ts'), + default: impTarget, + } } if (reqTarget) { - exp.require = { - types: reqTarget.replace(/\.(c?)js$/, '.d.$1ts'), - default: reqTarget, - } + exp.require = liveDev + ? reqTarget + : { + types: reqTarget.replace(/\.(c?)js$/, '.d.$1ts'), + default: reqTarget, + } } } return e diff --git a/src/types.ts b/src/types.ts index 26bba6f..7be5f2e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -13,6 +13,7 @@ export type TshyConfigMaybeGlobExports = { esmDialects?: string[] project?: string exclude?: string[] + liveDev?: boolean } export type TshyConfig = TshyConfigMaybeGlobExports & { diff --git a/tap-snapshots/test/build-live-commonjs.ts.test.cjs b/tap-snapshots/test/build-live-commonjs.ts.test.cjs new file mode 100644 index 0000000..11cf55e --- /dev/null +++ b/tap-snapshots/test/build-live-commonjs.ts.test.cjs @@ -0,0 +1,16 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/build-live-commonjs.ts > TAP > commonjs live dev build > must match snapshot 1`] = ` +Array [ + "blah-blah.cts", + "blah-cjs.cts", + "blah.ts", + "index.ts", + "package.json", +] +` diff --git a/tap-snapshots/test/build-live-esm.ts.test.cjs b/tap-snapshots/test/build-live-esm.ts.test.cjs new file mode 100644 index 0000000..96eb76d --- /dev/null +++ b/tap-snapshots/test/build-live-esm.ts.test.cjs @@ -0,0 +1,16 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/build-live-esm.ts > TAP > esm live dev build > must match snapshot 1`] = ` +Array [ + "blah-blah.mts", + "blah-cjs.cts", + "blah.ts", + "index.ts", + "package.json", +] +` diff --git a/tap-snapshots/test/build.ts.test.cjs b/tap-snapshots/test/build.ts.test.cjs index 95d6063..4f6028c 100644 --- a/tap-snapshots/test/build.ts.test.cjs +++ b/tap-snapshots/test/build.ts.test.cjs @@ -367,17 +367,13 @@ Array [ "dist", ], ], -] -` - -exports[`test/build.ts > TAP > build commonjs only > must match snapshot 1`] = ` -Array [ Array [ "self-link.link", Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -395,6 +391,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -412,6 +409,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -429,6 +427,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -446,6 +445,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -463,6 +463,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -480,6 +481,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -497,6 +499,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -514,6 +517,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -531,6 +535,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ + "esm", "commonjs", ], "exports": Object { @@ -542,11 +547,6 @@ Array [ "dist", ], ], -] -` - -exports[`test/build.ts > TAP > build esm only > must match snapshot 1`] = ` -Array [ Array [ "self-link.link", Array [ @@ -554,6 +554,7 @@ Array [ "tshy": Object { "dialects": Array [ "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -571,6 +572,7 @@ Array [ "tshy": Object { "dialects": Array [ "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -588,6 +590,7 @@ Array [ "tshy": Object { "dialects": Array [ "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -605,6 +608,7 @@ Array [ "tshy": Object { "dialects": Array [ "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -622,6 +626,7 @@ Array [ "tshy": Object { "dialects": Array [ "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -632,13 +637,18 @@ Array [ "dist", ], ], +] +` + +exports[`test/build.ts > TAP > build commonjs only > must match snapshot 1`] = ` +Array [ Array [ "self-link.link", Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -655,7 +665,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -672,7 +682,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -689,7 +699,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -706,7 +716,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -723,7 +733,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -740,7 +750,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -757,7 +767,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -774,7 +784,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -791,7 +801,7 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", + "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -802,16 +812,14 @@ Array [ "dist", ], ], -] -` - -exports[`test/build.ts > TAP > default settings > must match snapshot 1`] = ` -Array [ Array [ "self-link.link", Array [ Object { "tshy": Object { + "dialects": Array [ + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", @@ -826,6 +834,9 @@ Array [ Array [ Object { "tshy": Object { + "dialects": Array [ + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", @@ -840,6 +851,9 @@ Array [ Array [ Object { "tshy": Object { + "dialects": Array [ + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", @@ -854,6 +868,9 @@ Array [ Array [ Object { "tshy": Object { + "dialects": Array [ + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", @@ -868,6 +885,9 @@ Array [ Array [ Object { "tshy": Object { + "dialects": Array [ + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", @@ -877,18 +897,12 @@ Array [ "dist", ], ], -] -` - -exports[`test/build.ts > TAP > imports linking > basic > must match snapshot 1`] = ` -Array [ Array [ "self-link.link", Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -906,7 +920,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -924,7 +937,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -942,7 +954,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -960,7 +971,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -978,7 +988,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -996,7 +1005,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -1014,7 +1022,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -1032,7 +1039,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -1050,7 +1056,6 @@ Array [ Object { "tshy": Object { "dialects": Array [ - "esm", "commonjs", ], "exports": Object { @@ -1062,6 +1067,11 @@ Array [ "dist", ], ], +] +` + +exports[`test/build.ts > TAP > build esm only > must match snapshot 1`] = ` +Array [ Array [ "self-link.link", Array [ @@ -1069,7 +1079,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1087,7 +1096,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1105,7 +1113,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1123,7 +1130,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1141,7 +1147,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1159,7 +1164,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1177,7 +1181,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1195,7 +1198,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1213,7 +1215,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1231,7 +1232,6 @@ Array [ "tshy": Object { "dialects": Array [ "esm", - "commonjs", ], "exports": Object { ".": "./src/index.ts", @@ -1246,83 +1246,15 @@ Array [ "self-link.link", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", - }, "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], @@ -1331,83 +1263,15 @@ Array [ "imports.link", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", - }, "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], @@ -1416,83 +1280,15 @@ Array [ "imports.unlink", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", - }, "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], @@ -1501,83 +1297,15 @@ Array [ "self-link.unlink", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", - }, "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], @@ -1586,791 +1314,2376 @@ Array [ "self-link.link", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, - "dist", + "src", ], ], Array [ "imports.link", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, - "dist/commonjs", - true, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", ], ], Array [ "imports.link", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, - "dist/esm", - true, + "src", ], ], Array [ - "imports.save", + "self-link.link", Array [ - "dist/.tshy-link-imports.mjs", + Object { + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", ], ], Array [ "self-link.link", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], ], Array [ - "imports.link", + "imports.unlink", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, - }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { "tshy": Object { + "dialects": Array [ + "esm", + ], "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], ], Array [ - "imports.unlink", + "self-link.link", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, - }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "dialects": Array [ + "esm", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, + }, + "dist", + ], + ], +] +` + +exports[`test/build.ts > TAP > default settings > must match snapshot 1`] = ` +Array [ + Array [ + "self-link.link", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], ], Array [ - "self-link.unlink", + "imports.link", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, - }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], ], Array [ - "self-link.link", + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], +] +` + +exports[`test/build.ts > TAP > imports linking > basic > must match snapshot 1`] = ` +Array [ + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "dist", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "dist/commonjs", + true, + ], + ], + Array [ + "imports.link", + Array [ + Object { + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "dist/esm", + true, + ], + ], + Array [ + "imports.save", + Array [ + "dist/.tshy-link-imports.mjs", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "dist", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "dist/commonjs", + true, + ], + ], + Array [ + "imports.link", Array [ Object { "exports": Object { @@ -2379,12 +3692,940 @@ Array [ "default": "./dist/esm/index.js", "types": "./dist/esm/index.d.ts", }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "dist/esm", + true, + ], + ], + Array [ + "imports.save", + Array [ + "dist/.tshy-link-imports.mjs", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "name": "@my/package", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "name": "@my/package", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "name": "@my/package", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "name": "@my/package", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "name": "@my/package", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + "type": "module", + }, + "dist", + ], + ], +] +` + +exports[`test/build.ts > TAP > imports linking > imports > must match snapshot 1`] = ` +Array [ + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "./package.json": "./package.json", }, - "./foo": Object { + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "imports": Object { + "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ Object { @@ -2414,10 +4655,61 @@ Array [ ], "types": "./lib/foo-global.d.ts", }, - "./package.json": "./package.json", + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, }, + "type": "module", + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { "imports": Object { - "#c/*": "./lib/*.cjs", "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ @@ -2449,9 +4741,7 @@ Array [ "types": "./lib/foo-global.d.ts", }, "#fs": "node:fs", - "#m/*": "./lib/*.mjs", "#ri": "resolve-import", - "#ri/*": "resolve-import/*", "#root": "./root.mjs", "#xp": "xyz/package.json", }, @@ -2497,25 +4787,100 @@ Array [ }, "type": "module", }, - "dist", + "src", ], ], Array [ - "imports.link", + "self-link.unlink", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "./package.json": "./package.json", }, - "./foo": Object { + }, + "type": "module", + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "imports": Object { + "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ Object { @@ -2545,10 +4910,61 @@ Array [ ], "types": "./lib/foo-global.d.ts", }, - "./package.json": "./package.json", + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, }, + "type": "module", + }, + "dist", + ], + ], + Array [ + "imports.link", + Array [ + Object { "imports": Object { - "#c/*": "./lib/*.cjs", "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ @@ -2580,9 +4996,7 @@ Array [ "types": "./lib/foo-global.d.ts", }, "#fs": "node:fs", - "#m/*": "./lib/*.mjs", "#ri": "resolve-import", - "#ri/*": "resolve-import/*", "#root": "./root.mjs", "#xp": "xyz/package.json", }, @@ -2636,51 +5050,7 @@ Array [ "imports.link", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, - }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, "imports": Object { - "#c/*": "./lib/*.cjs", "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ @@ -2712,9 +5082,7 @@ Array [ "types": "./lib/foo-global.d.ts", }, "#fs": "node:fs", - "#m/*": "./lib/*.mjs", "#ri": "resolve-import", - "#ri/*": "resolve-import/*", "#root": "./root.mjs", "#xp": "xyz/package.json", }, @@ -2770,18 +5138,25 @@ Array [ "dist/.tshy-link-imports.mjs", ], ], +] +` + +exports[`test/build.ts > TAP > imports linking > imports-with-star > must match snapshot 1`] = ` +Array [ Array [ "self-link.link", Array [ Object { - "name": "@my/package", "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], @@ -2790,14 +5165,196 @@ Array [ "imports.link", Array [ Object { - "name": "@my/package", "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], @@ -2806,14 +5363,16 @@ Array [ "imports.unlink", Array [ Object { - "name": "@my/package", "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], @@ -2822,14 +5381,16 @@ Array [ "self-link.unlink", Array [ Object { - "name": "@my/package", "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", }, }, - "type": "module", }, "src", ], @@ -2838,23 +5399,20 @@ Array [ "self-link.link", Array [ Object { - "name": "@my/package", "tshy": Object { + "dialects": Array [ + "esm", + "commonjs", + ], "exports": Object { ".": "./src/index.ts", "./package.json": "./package.json", }, }, - "type": "module", }, "dist", ], ], -] -` - -exports[`test/build.ts > TAP > imports linking > imports > must match snapshot 1`] = ` -Array [ Array [ "self-link.link", Array [ @@ -3684,465 +6242,529 @@ Array [ "scripts": Object { "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, - "tshy": Object { - "exports": Object { - ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, - }, - "type": "module", - }, - "dist/commonjs", - true, - ], - ], - Array [ - "imports.link", - Array [ - Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", - }, - "tshy": Object { - "exports": Object { - ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, - }, - "type": "module", - }, - "dist/esm", - true, - ], - ], - Array [ - "imports.save", - Array [ - "dist/.tshy-link-imports.mjs", - ], - ], -] -` - -exports[`test/build.ts > TAP > imports linking > imports-with-star > must match snapshot 1`] = ` -Array [ - Array [ - "self-link.link", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", - }, - }, - }, - "src", - ], - ], - Array [ - "imports.link", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", - }, - }, - }, - "src", - ], - ], - Array [ - "imports.unlink", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", - }, - }, - }, - "src", - ], - ], - Array [ - "self-link.unlink", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", - }, - }, - }, - "src", - ], - ], - Array [ - "self-link.link", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", - }, - }, - }, - "dist", - ], - ], - Array [ - "self-link.link", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], + "tshy": Object { "exports": Object { ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, "./package.json": "./package.json", }, }, + "type": "module", }, - "src", + "dist/commonjs", + true, ], ], Array [ "imports.link", Array [ Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", + "imports": Object { + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "#fs": "node:fs", + "#ri": "resolve-import", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, - }, - "src", - ], - ], - Array [ - "imports.unlink", - Array [ - Object { "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], "exports": Object { ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, "./package.json": "./package.json", }, }, + "type": "module", }, - "src", + "dist/esm", + true, ], ], Array [ - "self-link.unlink", + "imports.save", Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", - }, - }, - }, - "src", + "dist/.tshy-link-imports.mjs", ], ], Array [ "self-link.link", Array [ Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "./package.json": "./package.json", }, - }, - "dist", - ], - ], - Array [ - "self-link.link", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, - }, - "src", - ], - ], - Array [ - "imports.link", - Array [ - Object { "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], "exports": Object { ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, "./package.json": "./package.json", }, }, + "type": "module", }, "src", ], ], Array [ - "imports.unlink", + "imports.link", Array [ Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "./package.json": "./package.json", + }, + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", + }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, - }, - "src", - ], - ], - Array [ - "self-link.unlink", - Array [ - Object { "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], "exports": Object { ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, "./package.json": "./package.json", }, }, + "type": "module", }, "src", ], ], Array [ - "self-link.link", + "imports.unlink", Array [ Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "./package.json": "./package.json", }, - }, - "dist", - ], - ], - Array [ - "self-link.link", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", + "imports": Object { + "#c/*": "./lib/*.cjs", + "#foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "#fs": "node:fs", + "#m/*": "./lib/*.mjs", + "#ri": "resolve-import", + "#ri/*": "resolve-import/*", + "#root": "./root.mjs", + "#xp": "xyz/package.json", }, - }, - "src", - ], - ], - Array [ - "imports.link", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", - }, + "name": "@my/package", + "scripts": Object { + "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", }, - }, - "src", - ], - ], - Array [ - "imports.unlink", - Array [ - Object { "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], "exports": Object { ".": "./src/index.ts", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, "./package.json": "./package.json", }, }, + "type": "module", }, "src", ], @@ -4151,43 +6773,51 @@ Array [ "self-link.unlink", Array [ Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, }, - }, - }, - "src", - ], - ], - Array [ - "self-link.link", - Array [ - Object { - "tshy": Object { - "dialects": Array [ - "esm", - "commonjs", - ], - "exports": Object { - ".": "./src/index.ts", - "./package.json": "./package.json", + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", }, + "./package.json": "./package.json", }, - }, - "dist", - ], - ], - Array [ - "self-link.link", - Array [ - Object { "imports": Object { + "#c/*": "./lib/*.cjs", "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ @@ -4219,7 +6849,9 @@ Array [ "types": "./lib/foo-global.d.ts", }, "#fs": "node:fs", + "#m/*": "./lib/*.mjs", "#ri": "resolve-import", + "#ri/*": "resolve-import/*", "#root": "./root.mjs", "#xp": "xyz/package.json", }, @@ -4269,10 +6901,54 @@ Array [ ], ], Array [ - "imports.link", + "self-link.link", Array [ Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, "imports": Object { + "#c/*": "./lib/*.cjs", "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ @@ -4304,7 +6980,9 @@ Array [ "types": "./lib/foo-global.d.ts", }, "#fs": "node:fs", + "#m/*": "./lib/*.mjs", "#ri": "resolve-import", + "#ri/*": "resolve-import/*", "#root": "./root.mjs", "#xp": "xyz/package.json", }, @@ -4348,16 +7026,60 @@ Array [ "./package.json": "./package.json", }, }, - "type": "module", - }, - "src", - ], - ], - Array [ - "imports.unlink", - Array [ - Object { + "type": "module", + }, + "dist", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { + "default": "./lib/foo-browser.js", + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-import.mjs", + ], + "node": Object { + "import": Array [ + Object { + "types": "./lib/foo.d.mts", + }, + "./lib/foo-node.mjs", + ], + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-node.cjs", + ], + }, + "require": Array [ + Object { + "types": "./lib/foo.d.cts", + }, + "./lib/foo-require.cjs", + ], + "types": "./lib/foo-global.d.ts", + }, + "./package.json": "./package.json", + }, "imports": Object { + "#c/*": "./lib/*.cjs", "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ @@ -4389,7 +7111,9 @@ Array [ "types": "./lib/foo-global.d.ts", }, "#fs": "node:fs", + "#m/*": "./lib/*.mjs", "#ri": "resolve-import", + "#ri/*": "resolve-import/*", "#root": "./root.mjs", "#xp": "xyz/package.json", }, @@ -4435,15 +7159,26 @@ Array [ }, "type": "module", }, - "src", + "dist/commonjs", + true, ], ], Array [ - "self-link.unlink", + "imports.link", Array [ Object { - "imports": Object { - "#foo": Object { + "exports": Object { + ".": Object { + "import": Object { + "default": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + }, + "require": Object { + "default": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + }, + }, + "./foo": Object { "default": "./lib/foo-browser.js", "import": Array [ Object { @@ -4473,61 +7208,10 @@ Array [ ], "types": "./lib/foo-global.d.ts", }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", - }, - "tshy": Object { - "exports": Object { - ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, + "./package.json": "./package.json", }, - "type": "module", - }, - "src", - ], - ], - Array [ - "self-link.link", - Array [ - Object { "imports": Object { + "#c/*": "./lib/*.cjs", "#foo": Object { "default": "./lib/foo-browser.js", "import": Array [ @@ -4559,7 +7243,9 @@ Array [ "types": "./lib/foo-global.d.ts", }, "#fs": "node:fs", + "#m/*": "./lib/*.mjs", "#ri": "resolve-import", + "#ri/*": "resolve-import/*", "#root": "./root.mjs", "#xp": "xyz/package.json", }, @@ -4603,316 +7289,339 @@ Array [ "./package.json": "./package.json", }, }, - "type": "module", + "type": "module", + }, + "dist/esm", + true, + ], + ], + Array [ + "imports.save", + Array [ + "dist/.tshy-link-imports.mjs", + ], + ], +] +` + +exports[`test/build.ts > TAP > liveDev > no envs > must match snapshot 1`] = ` +Array [ + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "dist", + ], + ], +] +` + +exports[`test/build.ts > TAP > liveDev > pack > must match snapshot 1`] = ` +Array [ + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, }, - "dist", + "src", ], ], Array [ "imports.link", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + "liveDev": true, }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, - "dist/commonjs", - true, + "src", ], ], Array [ - "imports.link", + "self-link.unlink", Array [ Object { - "imports": Object { - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#ri": "resolve-import", - "#root": "./root.mjs", - "#xp": "xyz/package.json", + "liveDev": true, }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, - "dist/esm", - true, + "src", ], ], Array [ - "imports.save", + "imports.link", Array [ - "dist/.tshy-link-imports.mjs", + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", ], ], Array [ - "self-link.link", + "imports.unlink", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./package.json": "./package.json", + "liveDev": true, }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + "liveDev": true, }, + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, "src", ], @@ -4921,260 +7630,108 @@ Array [ "imports.link", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, - }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./package.json": "./package.json", + "liveDev": true, }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", + "liveDev": true, }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "dist", + ], + ], +] +` + +exports[`test/build.ts > TAP > liveDev > publish > must match snapshot 1`] = ` +Array [ + Array [ + "self-link.link", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, "src", ], ], Array [ - "imports.unlink", + "imports.link", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, - }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + "liveDev": true, }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, "src", ], @@ -5183,129 +7740,13 @@ Array [ "self-link.unlink", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, - }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "./package.json": "./package.json", - }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", - }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", - }, "tshy": Object { - "exports": Object { - ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, + "exports": Object { + ".": "./src/index.ts", "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, "src", ], @@ -5314,401 +7755,240 @@ Array [ "self-link.link", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, - }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./package.json": "./package.json", + "liveDev": true, }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", + "liveDev": true, }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, - "dist", + "src", ], ], Array [ - "imports.link", + "self-link.unlink", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./package.json": "./package.json", + "liveDev": true, }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", + "liveDev": true, }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, - "dist/commonjs", - true, + "src", ], ], Array [ - "imports.link", + "self-link.unlink", Array [ Object { - "exports": Object { - ".": Object { - "import": Object { - "default": "./dist/esm/index.js", - "types": "./dist/esm/index.d.ts", - }, - "require": Object { - "default": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - }, + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "./package.json": "./package.json", + "liveDev": true, }, - "imports": Object { - "#c/*": "./lib/*.cjs", - "#foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", + }, + "dist", + ], + ], + Array [ + "self-link.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", }, - "#fs": "node:fs", - "#m/*": "./lib/*.mjs", - "#ri": "resolve-import", - "#ri/*": "resolve-import/*", - "#root": "./root.mjs", - "#xp": "xyz/package.json", + "liveDev": true, }, - "name": "@my/package", - "scripts": Object { - "preinstall": "node -e \\"import(process.argv[1]).catch(()=>{})\\" dist/.tshy-link-imports.mjs", + }, + "src", + ], + ], + Array [ + "imports.link", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "src", + ], + ], + Array [ + "imports.unlink", + Array [ + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, }, + }, + "src", + ], + ], + Array [ + "self-link.unlink", + Array [ + Object { "tshy": Object { "exports": Object { ".": "./src/index.ts", - "./foo": Object { - "default": "./lib/foo-browser.js", - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-import.mjs", - ], - "node": Object { - "import": Array [ - Object { - "types": "./lib/foo.d.mts", - }, - "./lib/foo-node.mjs", - ], - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-node.cjs", - ], - }, - "require": Array [ - Object { - "types": "./lib/foo.d.cts", - }, - "./lib/foo-require.cjs", - ], - "types": "./lib/foo-global.d.ts", - }, "./package.json": "./package.json", }, + "liveDev": true, }, - "type": "module", }, - "dist/esm", - true, + "src", ], ], Array [ - "imports.save", + "self-link.link", Array [ - "dist/.tshy-link-imports.mjs", + Object { + "tshy": Object { + "exports": Object { + ".": "./src/index.ts", + "./package.json": "./package.json", + }, + "liveDev": true, + }, + }, + "dist", ], ], ] diff --git a/tap-snapshots/test/exports.ts.test.cjs b/tap-snapshots/test/exports.ts.test.cjs index a639ea5..d691133 100644 --- a/tap-snapshots/test/exports.ts.test.cjs +++ b/tap-snapshots/test/exports.ts.test.cjs @@ -171,6 +171,156 @@ Object { } ` +exports[`test/exports.ts > TAP > liveDev > no envs > must match snapshot 1`] = ` +Object { + ".": Object { + "deno": "./dist/deno/index.ts", + "blah": "./dist/blah/index.ts", + "import": "./dist/esm/index.ts", + "require": "./dist/commonjs/index.ts", + }, + "./package.json": "./package.json", + "./foo": Object { + "deno": "./dist/deno/foo.mts", + "import": "./dist/esm/foo.mts", + }, + "./foo-cjs": Object { + "blah": "./dist/blah/foo.cts", + "require": "./dist/commonjs/foo.cts", + }, + "./fill": Object { + "deno": "./dist/deno/fill.ts", + "blah": "./dist/blah/fill.ts", + "import": "./dist/esm/fill.ts", + "require": "./dist/commonjs/fill.ts", + }, +} +` + +exports[`test/exports.ts > TAP > liveDev > pack > must match snapshot 1`] = ` +Object { + ".": Object { + "deno": Object { + "types": "./dist/deno/index.d.ts", + "default": "./dist/deno/index.js", + }, + "blah": Object { + "types": "./dist/blah/index.d.ts", + "default": "./dist/blah/index.js", + }, + "import": Object { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js", + }, + "require": Object { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js", + }, + }, + "./package.json": "./package.json", + "./foo": Object { + "deno": Object { + "types": "./dist/deno/foo.mjs", + "default": "./dist/deno/foo.mjs", + }, + "import": Object { + "types": "./dist/esm/foo.d.mts", + "default": "./dist/esm/foo.mjs", + }, + }, + "./foo-cjs": Object { + "blah": Object { + "types": "./dist/blah/foo.cjs", + "default": "./dist/blah/foo.cjs", + }, + "require": Object { + "types": "./dist/commonjs/foo.d.cts", + "default": "./dist/commonjs/foo.cjs", + }, + }, + "./fill": Object { + "deno": Object { + "types": "./dist/deno/fill.d.ts", + "default": "./dist/deno/fill.js", + }, + "blah": Object { + "types": "./dist/blah/fill.d.ts", + "default": "./dist/blah/fill.js", + }, + "import": Object { + "types": "./dist/esm/fill.d.ts", + "default": "./dist/esm/fill.js", + }, + "require": Object { + "types": "./dist/commonjs/fill.d.ts", + "default": "./dist/commonjs/fill.js", + }, + }, +} +` + +exports[`test/exports.ts > TAP > liveDev > publish > must match snapshot 1`] = ` +Object { + ".": Object { + "deno": Object { + "types": "./dist/deno/index.d.ts", + "default": "./dist/deno/index.js", + }, + "blah": Object { + "types": "./dist/blah/index.d.ts", + "default": "./dist/blah/index.js", + }, + "import": Object { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js", + }, + "require": Object { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js", + }, + }, + "./package.json": "./package.json", + "./foo": Object { + "deno": Object { + "types": "./dist/deno/foo.mjs", + "default": "./dist/deno/foo.mjs", + }, + "import": Object { + "types": "./dist/esm/foo.d.mts", + "default": "./dist/esm/foo.mjs", + }, + }, + "./foo-cjs": Object { + "blah": Object { + "types": "./dist/blah/foo.cjs", + "default": "./dist/blah/foo.cjs", + }, + "require": Object { + "types": "./dist/commonjs/foo.d.cts", + "default": "./dist/commonjs/foo.cjs", + }, + }, + "./fill": Object { + "deno": Object { + "types": "./dist/deno/fill.d.ts", + "default": "./dist/deno/fill.js", + }, + "blah": Object { + "types": "./dist/blah/fill.d.ts", + "default": "./dist/blah/fill.js", + }, + "import": Object { + "types": "./dist/esm/fill.d.ts", + "default": "./dist/esm/fill.js", + }, + "require": Object { + "types": "./dist/commonjs/fill.d.ts", + "default": "./dist/commonjs/fill.js", + }, + }, +} +` + exports[`test/exports.ts > TAP > setting top level main > invalid main commonjs, no exports > must match snapshot 1`] = ` Array [ Array [ diff --git a/test/build-live-commonjs.ts b/test/build-live-commonjs.ts new file mode 100644 index 0000000..ac9c344 --- /dev/null +++ b/test/build-live-commonjs.ts @@ -0,0 +1,34 @@ +import { readdirSync } from 'fs' +import t from 'tap' + +const output = () => + readdirSync('.tshy-build/commonjs').sort((a, b) => + a.localeCompare(b, 'en') + ) + +t.test('commonjs live dev build', async t => { + t.chdir( + t.testdir({ + 'package.json': JSON.stringify({ + tshy: { + commonjsDialects: ['blah', 'no-overrides'], + exports: { + '.': './src/index.ts', + './blah': './src/blah.ts', + }, + }, + }), + src: { + 'index.ts': 'console.log("hello")', + 'blah.ts': '', + 'blah-blah.cts': '', + 'blah-cjs.cts': '', + }, + }) + ) + const { buildLiveCommonJS } = await t.mockImport< + typeof import('../src/build-live-commonjs.js') + >('../src/build-live-commonjs.js') + buildLiveCommonJS() + t.matchSnapshot(output()) +}) diff --git a/test/build-live-esm.ts b/test/build-live-esm.ts new file mode 100644 index 0000000..6387384 --- /dev/null +++ b/test/build-live-esm.ts @@ -0,0 +1,34 @@ +import { readdirSync } from 'fs' +import t from 'tap' + +const output = () => + readdirSync('.tshy-build/esm').sort((a, b) => + a.localeCompare(b, 'en') + ) + +t.test('esm live dev build', async t => { + t.chdir( + t.testdir({ + 'package.json': JSON.stringify({ + tshy: { + esmDialects: ['blah', 'no-overrides'], + exports: { + '.': './src/index.ts', + './blah': './src/blah.ts', + }, + }, + }), + src: { + 'index.ts': '', + 'blah.ts': '', + 'blah-blah.mts': '', + 'blah-cjs.cts': '', + }, + }) + ) + const { buildLiveESM } = await t.mockImport< + typeof import('../src/build-live-esm.js') + >('../src/build-live-esm.js') + buildLiveESM() + t.matchSnapshot(output()) +}) diff --git a/test/build.ts b/test/build.ts index c66740b..bad9f2e 100644 --- a/test/build.ts +++ b/test/build.ts @@ -7,9 +7,13 @@ const pkg = {} as unknown as Package let builtCommonJS = false let builtESM = false +let builtLiveCommonJS = false +let builtLiveESM = false t.beforeEach(() => { builtCommonJS = false builtESM = false + builtLiveCommonJS = false + builtLiveESM = false }) const logCall = t.captureFn((_msg: string, _args: any[]) => {}) @@ -30,7 +34,13 @@ const mocks = { '../dist/esm/build-commonjs.js': { buildCommonJS: () => (builtCommonJS = true), }, + '../dist/esm/build-live-commonjs.js': { + buildLiveCommonJS: () => (builtLiveCommonJS = true), + }, '../dist/esm/build-esm.js': { buildESM: () => (builtESM = true) }, + '../dist/esm/build-live-esm.js': { + buildLiveESM: () => (builtLiveESM = true), + }, rimraf: { rimrafSync: () => {} }, '../dist/esm/tsconfig.js': {}, '../dist/esm/write-package.js': { default: () => {} }, @@ -50,9 +60,47 @@ t.test('default settings', async t => { await build() t.equal(builtESM, true) t.equal(builtCommonJS, true) + t.equal(builtLiveESM, false) + t.equal(builtLiveCommonJS, false) t.matchSnapshot(calls()) }) +t.test('liveDev', async t => { + pkg.tshy = { liveDev: true } + t.test('no envs', async t => { + const { default: build } = await t.mockImport( + '../dist/esm/build.js', + mocks + ) + await build() + t.equal(builtESM, false) + t.equal(builtCommonJS, false) + t.equal(builtLiveESM, true) + t.equal(builtLiveCommonJS, true) + t.matchSnapshot(calls()) + }) + for (const s of ['pack', 'publish']) { + t.test(s, async t => { + t.intercept(process, 'env', { + value: { + ...process.env, + npm_command: s, + }, + }) + const { default: build } = await t.mockImport( + '../dist/esm/build.js', + mocks + ) + await build() + t.equal(builtESM, true) + t.equal(builtCommonJS, true) + t.equal(builtLiveESM, false) + t.equal(builtLiveCommonJS, false) + t.matchSnapshot(calls()) + }) + } +}) + t.test('build commonjs only', async t => { pkg.tshy = { dialects: ['commonjs'] } const { default: build } = await t.mockImport( diff --git a/test/exports.ts b/test/exports.ts index 5a75607..f3ee654 100644 --- a/test/exports.ts +++ b/test/exports.ts @@ -316,3 +316,123 @@ t.test('extra dialects', async t => { } t.end() }) + +t.test('liveDev', async t => { + const pkg: Package = { + name: 'x', + version: '1.2.3', + tshy: { + liveDev: true, + dialects: ['commonjs', 'esm'], + esmDialects: ['deno'], + commonjsDialects: ['blah'], + exports: { + '.': './src/index.ts', + './package.json': './package.json', + './foo': './src/foo.mts', + './foo-cjs': './src/foo.cts', + './fill': './src/fill.ts', + }, + }, + } + const getLiveDev = async (t: Test) => { + t.chdir( + t.testdir({ + 'package.json': JSON.stringify(pkg), + src: { + 'index.ts': '', + 'foo.mts': '', + 'foo-deno.mts': '', + 'foo.cts': '', + 'fill.ts': '', + 'fill-cjs.cts': '', + }, + }) + ) + return await t.mockImport( + '../src/exports.js', + { + '../src/config.js': { default: pkg.tshy }, + '../src/package.js': { default: pkg }, + '../src/dialects.js': { default: ['commonjs', 'esm'] }, + '../src/sources.js': { + default: new Set([ + './src/index.ts', + './src/foo.mts', + './src/foo.cts', + './src/fill.ts', + './src/fill-cjs.cts', + ]), + }, + } + ) + } + t.test('no envs', async t => { + const ld = await getLiveDev(t) + t.equal(ld.getImpTarget('foo.cts'), undefined) + t.equal(ld.getImpTarget({ require: './foo.cts' }), undefined) + t.equal(ld.getImpTarget('./src/foo.cts'), undefined) + t.equal(ld.getImpTarget({ import: './foo.mts' }), './foo.mts') + t.equal(ld.getImpTarget('./src/foo.mts'), './dist/esm/foo.mts') + t.equal(ld.getImpTarget('./src/index.ts'), './dist/esm/index.ts') + t.equal(ld.getReqTarget(undefined, p), undefined) + t.equal(ld.getReqTarget('foo.cts', p), 'foo.cts') + t.equal(ld.getReqTarget('foo.mts', p), undefined) + t.equal(ld.getReqTarget({ require: './foo.cts' }, p), './foo.cts') + t.equal( + ld.getReqTarget('./src/foo.cts'), + './dist/commonjs/foo.cts' + ) + t.equal(ld.getReqTarget({ import: './foo.mts' }, p), undefined) + t.equal(ld.getReqTarget('./src/foo.mts', p), undefined) + t.equal( + ld.getReqTarget('./src/fill-cjs.cts', p), + './dist/commonjs/fill.ts' + ) + t.matchSnapshot(pkg.exports) + delete pkg.exports + t.end() + }) + + for (const c of ['publish', 'pack']) { + t.test(c, async t => { + t.intercept(process, 'env', { + value: { + ...process.env, + npm_command: c, + }, + }) + const ld = await getLiveDev(t) + // should be the same as not having liveDev: true + t.equal(ld.getImpTarget('foo.cts'), undefined) + t.equal(ld.getImpTarget({ require: './foo.cts' }), undefined) + t.equal(ld.getImpTarget('./src/foo.cts'), undefined) + t.equal(ld.getImpTarget({ import: './foo.mts' }), './foo.mts') + t.equal(ld.getImpTarget('./src/foo.mts'), './dist/esm/foo.mjs') + t.equal( + ld.getImpTarget('./src/index.ts'), + './dist/esm/index.js' + ) + t.equal(ld.getReqTarget(undefined, p), undefined) + t.equal(ld.getReqTarget('foo.cts', p), 'foo.cts') + t.equal(ld.getReqTarget('foo.mts', p), undefined) + t.equal( + ld.getReqTarget({ require: './foo.cts' }, p), + './foo.cts' + ) + t.equal( + ld.getReqTarget('./src/foo.cts'), + './dist/commonjs/foo.cjs' + ) + t.equal(ld.getReqTarget({ import: './foo.mts' }, p), undefined) + t.equal(ld.getReqTarget('./src/foo.mts', p), undefined) + t.equal( + ld.getReqTarget('./src/fill-cjs.cts', p), + './dist/commonjs/fill.js' + ) + t.matchSnapshot(pkg.exports) + delete pkg.exports + }) + } + t.end() +})