From 4bfcd67ea077e89316a693ef1e902bceb4ac18ce Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 5 Jun 2024 23:14:19 -0700 Subject: [PATCH] wip --- README.md | 23 + src/build-commonjs.ts | 14 +- src/build-esm.ts | 14 +- src/build-live-commonjs.ts | 43 + src/build-live-esm.ts | 41 + src/build.ts | 12 +- src/config.ts | 8 +- src/exports.ts | 57 +- src/if-exist.ts | 10 + src/types.ts | 1 + tap-snapshots/test/build.ts.test.cjs | 7336 +++++++++++++++++--------- test/build.ts | 46 + test/if-exist.ts | 18 + 13 files changed, 5053 insertions(+), 2570 deletions(-) create mode 100644 src/build-live-commonjs.ts create mode 100644 src/build-live-esm.ts create mode 100644 src/if-exist.ts create mode 100644 test/if-exist.ts diff --git a/README.md b/README.md index 826eaab..f7dd7c4 100644 --- a/README.md +++ b/README.md @@ -384,6 +384,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-commonjs.ts b/src/build-commonjs.ts index 35b4784..0f202df 100644 --- a/src/build-commonjs.ts +++ b/src/build-commonjs.ts @@ -1,10 +1,10 @@ import chalk from 'chalk' import { spawnSync } from 'node:child_process' -import { existsSync, renameSync, unlinkSync } from 'node:fs' import { relative, resolve } from 'node:path/posix' import buildFail from './build-fail.js' 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 './tsconfig.js' @@ -13,10 +13,6 @@ import tsc from './which-tsc.js' const node = process.execPath const { commonjsDialects = [] } = config -const unlinkIfExist = (f: string) => existsSync(f) && unlinkSync(f) -const renameIfExist = (f: string, to: string) => - existsSync(f) && renameSync(f, to) - export const buildCommonJS = () => { setFolderDialect('src', 'commonjs') for (const d of ['commonjs', ...commonjsDialects]) { @@ -41,10 +37,10 @@ export const buildCommonJS = () => { ).replace(/\.tsx?$/, '') const stemToPath = `${stemTo}.js.map` const stemToDtsPath = `${stemTo}.d.ts.map` - unlinkIfExist(stemToPath) - unlinkIfExist(stemToDtsPath) - renameIfExist(`${stemFrom}.cjs`, `${stemTo}.js`) - renameIfExist(`${stemFrom}.d.cts`, `${stemTo}.d.ts`) + ifExist.unlink(stemToPath) + ifExist.unlink(stemToDtsPath) + ifExist.rename(`${stemFrom}.cjs`, `${stemTo}.js`) + ifExist.rename(`${stemFrom}.d.cts`, `${stemTo}.d.ts`) } console.error(chalk.cyan.bold('built commonjs')) } diff --git a/src/build-esm.ts b/src/build-esm.ts index 6584070..d2526f8 100644 --- a/src/build-esm.ts +++ b/src/build-esm.ts @@ -1,19 +1,15 @@ import chalk from 'chalk' import { spawnSync } from 'node:child_process' -import { existsSync, renameSync, unlinkSync } from 'node:fs' import { relative, resolve } from 'node:path' import buildFail from './build-fail.js' 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 './tsconfig.js' import tsc from './which-tsc.js' -const unlinkIfExist = (f: string) => existsSync(f) && unlinkSync(f) -const renameIfExist = (f: string, to: string) => - existsSync(f) && renameSync(f, to) - const node = process.execPath const { esmDialects = [] } = config @@ -39,10 +35,10 @@ export const buildESM = () => { `.tshy-build/${d}`, relative(resolve('src'), resolve(orig)) ).replace(/\.tsx?$/, '') - unlinkIfExist(`${stemTo}.js.map`) - unlinkIfExist(`${stemTo}.d.ts.map`) - renameIfExist(`${stemFrom}.mjs`, `${stemTo}.js`) - renameIfExist(`${stemFrom}.d.mts`, `${stemTo}.d.ts`) + 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('built ' + d)) } 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..624f20c 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,21 @@ 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 3314c05..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)) @@ -58,7 +59,10 @@ const getConfig = ( ? pkg.tshy : {} let exportsConfig = tshy.exports - if (typeof exportsConfig === 'string' || Array.isArray(exportsConfig)) { + if ( + typeof exportsConfig === 'string' || + Array.isArray(exportsConfig) + ) { // Strip off the `./src` prefix and the extension // exports: "src/**/*.ts" => exports: {"./foo": "./src/foo.ts"} const exp: Exclude = {} 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/if-exist.ts b/src/if-exist.ts new file mode 100644 index 0000000..e5b2e90 --- /dev/null +++ b/src/if-exist.ts @@ -0,0 +1,10 @@ +import { existsSync, renameSync, unlinkSync } from 'fs' + +const unlink = (f: string) => existsSync(f) && unlinkSync(f) +const rename = (f: string, to: string) => + existsSync(f) && renameSync(f, to) + +export default { + unlink, + rename, +} 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.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/test/build.ts b/test/build.ts index 612b0c5..85397d4 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,45 @@ 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/if-exist.ts b/test/if-exist.ts new file mode 100644 index 0000000..9388c9a --- /dev/null +++ b/test/if-exist.ts @@ -0,0 +1,18 @@ +import {readdirSync} from 'fs' +import t from 'tap' +import ifExist from '../src/if-exist.js' + +const dir = t.testdir({ + a: 'a', + b: 'b', +}) + +ifExist.unlink(dir + '/x') +ifExist.rename(dir + '/x', dir + '/z') + +t.strictSame(new Set(readdirSync(dir)), new Set(['a', 'b'])) + +ifExist.unlink(dir + '/a') +ifExist.rename(dir + '/b', dir + '/c') + +t.strictSame(readdirSync(dir), ['c'])