@intentius/sql-yodeler 0.13.1 → 0.13.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/dist/bin.js +2 -2
- package/dist/bin.js.map +1 -1
- package/dist/chant/apply.js +3 -1
- package/dist/chant/apply.js.map +1 -1
- package/dist/chant/build.js +3 -1
- package/dist/chant/build.js.map +1 -1
- package/dist/chant/confirm.d.ts +20 -20
- package/dist/chant/confirm.js +14 -27
- package/dist/chant/confirm.js.map +1 -1
- package/dist/chant/drift.d.ts +0 -8
- package/dist/chant/drift.js +4 -21
- package/dist/chant/drift.js.map +1 -1
- package/dist/chant/sql-types.d.ts +4 -5
- package/dist/chant/sql-types.js +9 -10
- package/dist/chant/sql-types.js.map +1 -1
- package/dist/ci/render.d.ts +6 -0
- package/dist/ci/render.js +8 -3
- package/dist/ci/render.js.map +1 -1
- package/dist/commands/approve.d.ts +1 -1
- package/dist/commands/approve.js +6 -7
- package/dist/commands/approve.js.map +1 -1
- package/dist/commands/chant.d.ts +1 -1
- package/dist/commands/chant.js +2 -2
- package/dist/commands/chant.js.map +1 -1
- package/dist/commands/ci.js +40 -5
- package/dist/commands/ci.js.map +1 -1
- package/dist/commands/create.d.ts +2 -2
- package/dist/commands/create.js +2 -2
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/drift.js +3 -3
- package/dist/commands/drift.js.map +1 -1
- package/dist/commands/emulator.d.ts +2 -2
- package/dist/commands/emulator.js +2 -2
- package/dist/commands/emulator.js.map +1 -1
- package/dist/commands/override.js +2 -2
- package/dist/commands/override.js.map +1 -1
- package/dist/pr/issue.d.ts +7 -4
- package/dist/pr/issue.js +16 -10
- package/dist/pr/issue.js.map +1 -1
- package/dist/versioned/op.js +3 -1
- package/dist/versioned/op.js.map +1 -1
- package/package.json +7 -7
- package/dist/chant/process.d.ts +0 -34
- package/dist/chant/process.js +0 -74
- package/dist/chant/process.js.map +0 -1
- package/dist/chant/resolve-fallback.d.ts +0 -35
- package/dist/chant/resolve-fallback.js +0 -89
- package/dist/chant/resolve-fallback.js.map +0 -1
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Packages for a project with no `node_modules` of its own (#312).
|
|
3
|
-
*
|
|
4
|
-
* chant's commit job runs `yodel new` in a git worktree of the pull
|
|
5
|
-
* request's head, outside the checkout the job installed, so the worktree
|
|
6
|
-
* has no `node_modules` and nothing above it does either (chant pull
|
|
7
|
-
* request 4798). Its `chant.config.ts` and `src/` import chant, the sql
|
|
8
|
-
* lexicon and `@intentius/sql-yodeler` by name, and Node finds a package by
|
|
9
|
-
* walking up from the importing file, so every such import fails there.
|
|
10
|
-
*
|
|
11
|
-
* yodel itself runs from the checkout's install (`node_modules/.bin/yodel`
|
|
12
|
-
* on the job's PATH), or from the CI image's global one, and that install
|
|
13
|
-
* holds every package the project's files import. This module registers a
|
|
14
|
-
* Node resolve hook that retries a bare specifier from yodel's own
|
|
15
|
-
* `node_modules` when it was not found, and only for an importing file with
|
|
16
|
-
* no `node_modules` directory in itself or any directory above it, where
|
|
17
|
-
* the import could never resolve. A project that has its own install
|
|
18
|
-
* resolves as before: the hook only ever sees imports that already failed.
|
|
19
|
-
*
|
|
20
|
-
* yodel's bin registers it in its own process (`chant.config.ts` and the
|
|
21
|
-
* Ops are loaded there), and {@link fallbackImportArgs} gives the
|
|
22
|
-
* `--import` the chant children run with (`chant build`, `chant sql
|
|
23
|
-
* types`). The hooks are a `data:` module, so they load the same from
|
|
24
|
-
* `src/` under tsx and from `dist/`.
|
|
25
|
-
*/
|
|
26
|
-
import { createRequire, register } from "node:module";
|
|
27
|
-
import { dirname, join, sep } from "node:path";
|
|
28
|
-
import { pathToFileURL } from "node:url";
|
|
29
|
-
/** The resolve hook, run on Node's hooks thread. `data.parent` is a file URL in the directory that holds yodel's `node_modules`. */
|
|
30
|
-
const HOOKS = `
|
|
31
|
-
import { existsSync } from "node:fs";
|
|
32
|
-
import { dirname, join } from "node:path";
|
|
33
|
-
import { fileURLToPath } from "node:url";
|
|
34
|
-
let parent;
|
|
35
|
-
export function initialize(data) { parent = data && data.parent; }
|
|
36
|
-
const bare = (s) => !/^(\\.{0,2}\\/|[a-zA-Z][a-zA-Z0-9+.-]*:)/.test(s) && !s.startsWith("#");
|
|
37
|
-
function installed(url) {
|
|
38
|
-
if (!url || !url.startsWith("file:")) return true;
|
|
39
|
-
let d = dirname(fileURLToPath(url));
|
|
40
|
-
for (;;) {
|
|
41
|
-
if (existsSync(join(d, "node_modules"))) return true;
|
|
42
|
-
const up = dirname(d);
|
|
43
|
-
if (up === d) return false;
|
|
44
|
-
d = up;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export async function resolve(specifier, context, next) {
|
|
48
|
-
try {
|
|
49
|
-
return await next(specifier, context);
|
|
50
|
-
} catch (e) {
|
|
51
|
-
if (!parent || !e || e.code !== "ERR_MODULE_NOT_FOUND" || !bare(specifier) || installed(context.parentURL)) throw e;
|
|
52
|
-
return next(specifier, { ...context, parentURL: parent });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
const HOOKS_URL = `data:text/javascript,${encodeURIComponent(HOOKS)}`;
|
|
57
|
-
/** The `node_modules` directory yodel's own packages are installed in, found from chant's place in it. */
|
|
58
|
-
export function ownModules(from = import.meta.url) {
|
|
59
|
-
try {
|
|
60
|
-
const entry = createRequire(from).resolve("@intentius/chant");
|
|
61
|
-
const at = entry.lastIndexOf(`${sep}node_modules${sep}`);
|
|
62
|
-
return at < 0 ? undefined : entry.slice(0, at + `${sep}node_modules`.length);
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/** A file URL in the directory holding `modules`, from which a bare specifier resolves into it. */
|
|
69
|
-
const parentOf = (modules) => pathToFileURL(join(dirname(modules), "yodel-resolve-fallback.js")).href;
|
|
70
|
-
let registered = false;
|
|
71
|
-
/** Registers the hook in this process, once. */
|
|
72
|
-
export function registerResolveFallback(modules = ownModules()) {
|
|
73
|
-
if (registered || modules === undefined)
|
|
74
|
-
return;
|
|
75
|
-
registered = true;
|
|
76
|
-
register(HOOKS_URL, { data: { parent: parentOf(modules) } });
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* The `--import` a chant child runs with, before tsx's, so its own imports
|
|
80
|
-
* of the project's files get the same hook; none when yodel's install is
|
|
81
|
-
* not found.
|
|
82
|
-
*/
|
|
83
|
-
export function fallbackImportArgs(modules = ownModules()) {
|
|
84
|
-
if (modules === undefined)
|
|
85
|
-
return [];
|
|
86
|
-
const registerIt = `import { register } from "node:module"; register(${JSON.stringify(HOOKS_URL)}, { data: { parent: ${JSON.stringify(parentOf(modules))} } });`;
|
|
87
|
-
return ["--import", `data:text/javascript,${encodeURIComponent(registerIt)}`];
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=resolve-fallback.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-fallback.js","sourceRoot":"","sources":["../../src/chant/resolve-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,oIAAoI;AACpI,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBb,CAAC;AAEF,MAAM,SAAS,GAAG,wBAAwB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AAEtE,0GAA0G;AAC1G,MAAM,UAAU,UAAU,CAAC,OAAe,MAAM,CAAC,IAAI,CAAC,GAAG;IACvD,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,O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