@smoothbricks/nx-plugin 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -19
- package/dist/.build-inputs.json +1 -1
- package/dist/index.js +15 -4
- package/package.json +1 -1
- package/src/index.ts +18 -4
package/README.md
CHANGED
|
@@ -1139,25 +1139,28 @@ aggregates.
|
|
|
1139
1139
|
Concrete targets come from concrete files:
|
|
1140
1140
|
|
|
1141
1141
|
- `tsc-js` runs `ttsc -p tsconfig.lib.json --emit` with flags that make it emit transformed JavaScript, declarations and
|
|
1142
|
-
declaration maps from one non-incremental program, then restores execute bits on outputs
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
a
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1142
|
+
declaration maps from one non-incremental program, then restores execute bits on the `package.json#bin` outputs that
|
|
1143
|
+
emit wrote: each beneath its `outDir`, or JavaScript beneath `dist` when the config states no `outDir`. A bin another
|
|
1144
|
+
target writes (a second emit into `dist` beside a `dist-types` declaration emit, a bundle) is that target's to make
|
|
1145
|
+
executable, and a launcher checked into Git keeps the mode Git gives it: a clean checkout can run `tsc-js` before such
|
|
1146
|
+
a target, so a `tsc-js` that claimed its bin failed on a file nothing had written yet. It writes no file beside the
|
|
1147
|
+
tsconfig, whose directory a consumer's ttsc transform lists while it compiles. Direct project references and every
|
|
1148
|
+
cached output lane are preserved. The config's `outDir` is the target's only output and holds exactly what this emit
|
|
1149
|
+
wrote: the compiler rewrites every output it produces in place, so after a successful emit the executor removes each
|
|
1150
|
+
file under `outDir` whose inode, ctime and mtime are unchanged since before the emit, and each directory that leaves
|
|
1151
|
+
empty. A file an earlier build wrote and this one no longer does (a bin moved to another package, a deleted module) is
|
|
1152
|
+
gone before Nx captures the output, so no cache artifact carries it. A failed emit removes nothing, and an `outDir`
|
|
1153
|
+
that holds a TypeScript source is refused before the compiler runs. It writes `.build-inputs.json` into the `outDir`:
|
|
1154
|
+
the SHA-256 of every file the config's `include` matches less its `exclude`, taken before the emit, and those globs as
|
|
1155
|
+
Git pathspecs. Native targets write the same record from rustc's dep-info through `@smoothbricks/build-inputs`: macOS
|
|
1156
|
+
uses its `smoo-nx-build-inputs` CLI and Linux's `cargo-zigbuild` executor calls that same collector. A record produced
|
|
1157
|
+
under Nx also carries its producer's project, target and optional configuration, taken from the actual task
|
|
1158
|
+
environment. Shell entry uses that identity to judge the selected development receipts, including inferred targets
|
|
1159
|
+
absent from package manifests, and name their actual cached rebuild. It constructs no Nx graph, shadow output registry
|
|
1160
|
+
or second interpolation policy. The record is inside the target's outputs, so a cache hit restores it with them; a
|
|
1161
|
+
live developer link (`@smoothbricks/cli`, "Declared Links") checks it to tell a current build from a stale one by
|
|
1162
|
+
content. The shell entry that bootstraps the plugin (`tooling/direnv/enter-shell.ts`) keeps its build marker under
|
|
1163
|
+
`node_modules/.cache`, not under `outDir`, where the executor would remove it as a file its emit did not write.
|
|
1161
1164
|
- `scriptc-<arch>-<family>` (`scriptc-arm64-macos`, `scriptc-x64-macos`, `scriptc-arm64-linux`, `scriptc-x64-linux`) are
|
|
1162
1165
|
inferred for a package that lists `scriptc` in `devDependencies` (that pin is the compiler the targets run; the
|
|
1163
1166
|
workspace root lists `scriptc` in `trustedDependencies` so its install links the platform compiler) together with each
|
package/dist/.build-inputs.json
CHANGED
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"packages/nx-plugin/src/generators/make-public/schema.d.ts": "5e7bd2f1ce16795df4c919d6d53588ea85b574c84400940b6322275f96f60357",
|
|
88
88
|
"packages/nx-plugin/src/go-tests.ts": "8e356b6ee276e6e836c404353b0ffb5ccec5beb261126f167f730e6e01e9c2b6",
|
|
89
89
|
"packages/nx-plugin/src/graph-input-contract.ts": "8a1aec1294960ae80bcff55a0370c95004a911bf1afe6caa47e666da3baeac43",
|
|
90
|
-
"packages/nx-plugin/src/index.ts": "
|
|
90
|
+
"packages/nx-plugin/src/index.ts": "64dca8cf4bed31d59fab58576025b7aede5e1ccaa4996319189c37ebb4f2d60f",
|
|
91
91
|
"packages/nx-plugin/src/managed-assets.ts": "9cea959c09f3163992e666eecc5a65ec1f1b63c81fc56c5e99088507d02c5e3b",
|
|
92
92
|
"packages/nx-plugin/src/managed-files/ci-workflow.ts": "2d64d689e999af20d65cc21b4803659a835a6eb5340e8d3f896cb0c74e6a0878",
|
|
93
93
|
"packages/nx-plugin/src/managed-files/context.ts": "5b83c000322382cb781df4f415f3759388e69686b76779599572a62a5c4dd28c",
|
package/dist/index.js
CHANGED
|
@@ -1289,7 +1289,8 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1289
1289
|
const hasOrdinaryBuildOutputTarget = hasLibTsconfig || napiConfig !== null || cargoWasmConfig !== null || declaresPackageLocalBuildOutput(packageJson);
|
|
1290
1290
|
const isDeployableWranglerProject = packageJson.private === true && WRANGLER_CONFIG_FILES.some((file) => existsSync(join(absoluteProjectRoot, file)));
|
|
1291
1291
|
if (hasLibTsconfig) {
|
|
1292
|
-
const
|
|
1292
|
+
const libOutDir = typescriptOutDir(libTsconfigPath, packageJsonPath);
|
|
1293
|
+
const executableOutputs = packageBinOutputs(packageJson, packageJsonPath).filter((bin) => typescriptEmitWrites(libOutDir, bin));
|
|
1293
1294
|
// Dependency packages may publish bundled entries that raw tsc does not produce.
|
|
1294
1295
|
// Build every JavaScript output lane before resolving package exports, without pulling
|
|
1295
1296
|
// unrelated Wasm, N-API, native, or web outputs onto the compiler critical path.
|
|
@@ -1299,7 +1300,7 @@ async function createProjectTargets(packageJsonPath, workspaceRoot, hostPlatform
|
|
|
1299
1300
|
executor: '@smoothbricks/nx-plugin:typescript-emit',
|
|
1300
1301
|
cache: true,
|
|
1301
1302
|
inputs: ['production', '^production', ...toolchainInputs, '{projectRoot}/tsconfig.lib.json'],
|
|
1302
|
-
outputs: inferTypescriptOutputs(
|
|
1303
|
+
outputs: inferTypescriptOutputs(libOutDir),
|
|
1303
1304
|
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
|
|
1304
1305
|
options: {
|
|
1305
1306
|
...(executableOutputs.length > 0 ? { executableOutputs } : {}),
|
|
@@ -2161,8 +2162,7 @@ async function resolveCargoWasmConfig(absoluteProjectRoot, packageJsonPath, work
|
|
|
2161
2162
|
}
|
|
2162
2163
|
return resolved[0] ?? null;
|
|
2163
2164
|
}
|
|
2164
|
-
function inferTypescriptOutputs(
|
|
2165
|
-
const outDir = typescriptOutDir(tsconfigPath, packageJsonPath);
|
|
2165
|
+
function inferTypescriptOutputs(outDir) {
|
|
2166
2166
|
// No .tsbuildinfo here: the emit executor overlays incremental: false, so
|
|
2167
2167
|
// tsc-js never writes one and a declared-but-absent output fails the
|
|
2168
2168
|
// release-candidate output inspection.
|
|
@@ -2170,6 +2170,17 @@ function inferTypescriptOutputs(tsconfigPath, packageJsonPath) {
|
|
|
2170
2170
|
? ['{projectRoot}/dist/**/*.{js,cjs,mjs,jsx,d.ts,d.cts,d.mts}{,.map}']
|
|
2171
2171
|
: [`{projectRoot}/${outDir}/`];
|
|
2172
2172
|
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Whether the emit `inferTypescriptOutputs(outDir)` declares writes the project-relative `path`: a file beneath
|
|
2175
|
+
* outDir, or JavaScript beneath dist for a config that states no outDir. A package bin a second emit, a bundler or Git
|
|
2176
|
+
* puts elsewhere is not this emit's: a tsc-js that claimed one stat'ed it on a clean checkout before anything wrote it.
|
|
2177
|
+
*/
|
|
2178
|
+
function typescriptEmitWrites(outDir, path) {
|
|
2179
|
+
const emitted = posix.normalize(path.replaceAll('\\', '/'));
|
|
2180
|
+
return outDir === null
|
|
2181
|
+
? emitted.startsWith('dist/') && /\.(?:[cm]?js|jsx)$/.test(emitted)
|
|
2182
|
+
: emitted.startsWith(`${outDir}/`);
|
|
2183
|
+
}
|
|
2173
2184
|
/** The project-relative `compilerOptions.outDir` the config itself states, or null when it states none. */
|
|
2174
2185
|
function typescriptOutDir(tsconfigPath, packageJsonPath) {
|
|
2175
2186
|
const tsconfig = readJsonFile(tsconfigPath);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1638,7 +1638,10 @@ async function createProjectTargets(
|
|
|
1638
1638
|
packageJson.private === true && WRANGLER_CONFIG_FILES.some((file) => existsSync(join(absoluteProjectRoot, file)));
|
|
1639
1639
|
|
|
1640
1640
|
if (hasLibTsconfig) {
|
|
1641
|
-
const
|
|
1641
|
+
const libOutDir = typescriptOutDir(libTsconfigPath, packageJsonPath);
|
|
1642
|
+
const executableOutputs = packageBinOutputs(packageJson, packageJsonPath).filter((bin) =>
|
|
1643
|
+
typescriptEmitWrites(libOutDir, bin),
|
|
1644
|
+
);
|
|
1642
1645
|
// Dependency packages may publish bundled entries that raw tsc does not produce.
|
|
1643
1646
|
// Build every JavaScript output lane before resolving package exports, without pulling
|
|
1644
1647
|
// unrelated Wasm, N-API, native, or web outputs onto the compiler critical path.
|
|
@@ -1648,7 +1651,7 @@ async function createProjectTargets(
|
|
|
1648
1651
|
executor: '@smoothbricks/nx-plugin:typescript-emit',
|
|
1649
1652
|
cache: true,
|
|
1650
1653
|
inputs: ['production', '^production', ...toolchainInputs, '{projectRoot}/tsconfig.lib.json'],
|
|
1651
|
-
outputs: inferTypescriptOutputs(
|
|
1654
|
+
outputs: inferTypescriptOutputs(libOutDir),
|
|
1652
1655
|
dependsOn: ['^*-js', ...(cargoWasmConfig ? ['cargo-wasm'] : [])],
|
|
1653
1656
|
options: {
|
|
1654
1657
|
...(executableOutputs.length > 0 ? { executableOutputs } : {}),
|
|
@@ -2640,8 +2643,7 @@ interface ResolvedNapiConfig {
|
|
|
2640
2643
|
targets: string[];
|
|
2641
2644
|
}
|
|
2642
2645
|
|
|
2643
|
-
function inferTypescriptOutputs(
|
|
2644
|
-
const outDir = typescriptOutDir(tsconfigPath, packageJsonPath);
|
|
2646
|
+
function inferTypescriptOutputs(outDir: string | null): string[] {
|
|
2645
2647
|
// No .tsbuildinfo here: the emit executor overlays incremental: false, so
|
|
2646
2648
|
// tsc-js never writes one and a declared-but-absent output fails the
|
|
2647
2649
|
// release-candidate output inspection.
|
|
@@ -2650,6 +2652,18 @@ function inferTypescriptOutputs(tsconfigPath: string, packageJsonPath: string):
|
|
|
2650
2652
|
: [`{projectRoot}/${outDir}/`];
|
|
2651
2653
|
}
|
|
2652
2654
|
|
|
2655
|
+
/**
|
|
2656
|
+
* Whether the emit `inferTypescriptOutputs(outDir)` declares writes the project-relative `path`: a file beneath
|
|
2657
|
+
* outDir, or JavaScript beneath dist for a config that states no outDir. A package bin a second emit, a bundler or Git
|
|
2658
|
+
* puts elsewhere is not this emit's: a tsc-js that claimed one stat'ed it on a clean checkout before anything wrote it.
|
|
2659
|
+
*/
|
|
2660
|
+
function typescriptEmitWrites(outDir: string | null, path: string): boolean {
|
|
2661
|
+
const emitted = posix.normalize(path.replaceAll('\\', '/'));
|
|
2662
|
+
return outDir === null
|
|
2663
|
+
? emitted.startsWith('dist/') && /\.(?:[cm]?js|jsx)$/.test(emitted)
|
|
2664
|
+
: emitted.startsWith(`${outDir}/`);
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2653
2667
|
/** The project-relative `compilerOptions.outDir` the config itself states, or null when it states none. */
|
|
2654
2668
|
function typescriptOutDir(tsconfigPath: string, packageJsonPath: string): string | null {
|
|
2655
2669
|
const tsconfig: unknown = readJsonFile(tsconfigPath);
|