gagen 0.3.4 → 0.5.0
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 +56 -118
- package/esm/_dnt.polyfills.d.ts +99 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +127 -1
- package/esm/cli.d.ts +4 -0
- package/esm/cli.d.ts.map +1 -0
- package/esm/cli.js +88 -0
- package/esm/deps/jsr.io/@std/internal/{1.0.12 → 1.0.13}/build_message.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.12 → 1.0.13}/diff.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.12 → 1.0.13}/diff_str.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.12 → 1.0.13}/format.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.12 → 1.0.13}/styles.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.12 → 1.0.13}/types.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_dumper_state.d.ts +2 -2
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_dumper_state.js +2 -1
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_loader_state.js +12 -12
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/float.js +4 -4
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/stringify.d.ts +1 -1
- package/esm/deps/jsr.io/@std/yaml/1.1.0/stringify.d.ts.map +1 -0
- package/esm/job.d.ts.map +1 -1
- package/esm/job.js +3 -2
- package/esm/mod.d.ts +2 -2
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +5 -1
- package/esm/pin.d.ts +34 -4
- package/esm/pin.d.ts.map +1 -1
- package/esm/pin.js +107 -32
- package/esm/step.d.ts +4 -2
- package/esm/step.d.ts.map +1 -1
- package/esm/step.js +8 -1
- package/esm/workflow.d.ts.map +1 -1
- package/esm/workflow.js +4 -4
- package/package.json +4 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_chars.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_dumper_state.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_loader_state.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_schema.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/binary.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/bool.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/float.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/int.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/map.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/merge.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/nil.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/omap.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/pairs.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/regexp.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/seq.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/set.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/str.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/timestamp.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type/undefined.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_type.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/_utils.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/parse.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.0.12/stringify.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_chars.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_chars.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_loader_state.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_schema.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_schema.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/binary.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/binary.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/bool.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/bool.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/float.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/int.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/int.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/map.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/map.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/merge.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/merge.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/nil.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/nil.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/omap.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/omap.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/pairs.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/pairs.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/regexp.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/regexp.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/seq.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/seq.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/set.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/set.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/str.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/str.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/timestamp.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/timestamp.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/undefined.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type/undefined.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_type.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_utils.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/_utils.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/parse.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/parse.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.12 → 1.1.0}/stringify.js +0 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ initial code is more easily maintainable.
|
|
|
16
16
|
## Basic usage
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
|
-
|
|
19
|
+
// .github/workflows/ci.ts
|
|
20
20
|
import { conditions, step, workflow } from "gagen";
|
|
21
21
|
|
|
22
22
|
const checkout = step({
|
|
@@ -61,6 +61,13 @@ workflow({
|
|
|
61
61
|
});
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
Generate via the `gagen` cli:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
# or alternatively run the script directly
|
|
68
|
+
npx gagen
|
|
69
|
+
```
|
|
70
|
+
|
|
64
71
|
This generates a `ci.generated.yml` with steps in the correct order and figures
|
|
65
72
|
out that it should only install deno when the lint step should be run and it
|
|
66
73
|
defers that step only until it's necessary.
|
|
@@ -76,20 +83,17 @@ jobs:
|
|
|
76
83
|
build:
|
|
77
84
|
runs-on: ubuntu-latest
|
|
78
85
|
steps:
|
|
79
|
-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
86
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
80
87
|
- name: Clippy
|
|
81
88
|
if: github.ref != 'refs/heads/main'
|
|
82
89
|
run: cargo clippy
|
|
83
|
-
- uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282
|
|
90
|
+
- uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2
|
|
84
91
|
if: github.ref != 'refs/heads/main'
|
|
85
92
|
- name: Deno Lint
|
|
86
93
|
if: github.ref != 'refs/heads/main'
|
|
87
94
|
run: deno lint
|
|
88
95
|
- name: Test
|
|
89
96
|
run: cargo test
|
|
90
|
-
|
|
91
|
-
# gagen:pin actions/checkout@v6 = de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
92
|
-
# gagen:pin denoland/setup-deno@v2 = 667a34cdef165d8d2b2e98dde39547c9daac7282
|
|
93
97
|
```
|
|
94
98
|
|
|
95
99
|
When run normally, this writes `ci.generated.yml`. When run with `--lint`, it
|
|
@@ -100,10 +104,50 @@ up to date:
|
|
|
100
104
|
```ts
|
|
101
105
|
const lintStep = step({
|
|
102
106
|
name: "Lint CI generation",
|
|
107
|
+
// alternatively, use `npx gagen --lint` to lint all the files
|
|
108
|
+
// in the `.github/workflows` folder
|
|
103
109
|
run: "./.github/workflows/ci.ts --lint",
|
|
104
110
|
});
|
|
105
111
|
```
|
|
106
112
|
|
|
113
|
+
## CLI
|
|
114
|
+
|
|
115
|
+
If you store your generations scripts beside your `.yml` files in the
|
|
116
|
+
`.github/workflows` folder, then you can automatically run all these scripts by
|
|
117
|
+
using the `gagen` binary:
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
# generate the output
|
|
121
|
+
npx gagen
|
|
122
|
+
|
|
123
|
+
# lint the output
|
|
124
|
+
npx gagen --lint
|
|
125
|
+
|
|
126
|
+
# pull version bumps from generated yaml back into the source scripts
|
|
127
|
+
# (useful after dependabot updates a .generated.yml)
|
|
128
|
+
npx gagen --pull-versions
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The requires your scripts to use the `writeOrLint` function.
|
|
132
|
+
|
|
133
|
+
### `--pull-versions`
|
|
134
|
+
|
|
135
|
+
Dependabot updates the inline version comment on each `uses:` line of the
|
|
136
|
+
generated YAML (e.g. `actions/checkout@<new-hash> # v7`). The source script
|
|
137
|
+
still reads `v6`, so the next regeneration would revert the bump. Running
|
|
138
|
+
`npx gagen --pull-versions` scans every YAML in `.github/workflows`, collects
|
|
139
|
+
the current version for each action, then rewrites `"owner/repo@<old>"` literals
|
|
140
|
+
in the script files to match. The YAML is already up to date, so no regeneration
|
|
141
|
+
is needed.
|
|
142
|
+
|
|
143
|
+
Limitations:
|
|
144
|
+
|
|
145
|
+
- Only literal `"owner/repo@ref"` strings (double or single quoted) are
|
|
146
|
+
rewritten. Template literals with substitutions and computed uses values are
|
|
147
|
+
left alone.
|
|
148
|
+
- If the same action appears in multiple YAML files with different versions, it
|
|
149
|
+
is reported as a conflict and skipped — resolve it manually.
|
|
150
|
+
|
|
107
151
|
## Dependency pinning—the output is a lockfile
|
|
108
152
|
|
|
109
153
|
By default, `writeOrLint` pins action references to their resolved commit hashes
|
|
@@ -123,10 +167,12 @@ It will output:
|
|
|
123
167
|
|
|
124
168
|
```yaml
|
|
125
169
|
steps:
|
|
126
|
-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
127
|
-
# gagen:pin actions/checkout@v6 = 11bd71901bbe5b1630ceea73d27597364c9af683
|
|
170
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6
|
|
128
171
|
```
|
|
129
172
|
|
|
173
|
+
The inline comment records the original ref so gagen can re-resolve it when you
|
|
174
|
+
run with `--update-pins`.
|
|
175
|
+
|
|
130
176
|
Then the next time it runs, it will read the output to get a locked set of
|
|
131
177
|
dependencies.
|
|
132
178
|
|
|
@@ -417,68 +463,6 @@ workflow({
|
|
|
417
463
|
});
|
|
418
464
|
```
|
|
419
465
|
|
|
420
|
-
Also works with key-value arrays:
|
|
421
|
-
|
|
422
|
-
```ts
|
|
423
|
-
const matrix = defineMatrix({
|
|
424
|
-
os: ["linux", "macos"],
|
|
425
|
-
node: [18, 20],
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
matrix.os.equals("linux"); // condition for use in step `if`
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
### Matrix exclude
|
|
432
|
-
|
|
433
|
-
Pass an `exclude` array to remove specific combinations:
|
|
434
|
-
|
|
435
|
-
```ts
|
|
436
|
-
const matrix = defineMatrix({
|
|
437
|
-
os: ["linux", "macos"],
|
|
438
|
-
node: [18, 20],
|
|
439
|
-
exclude: [{ os: "macos", node: 18 }],
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
// matrix.os and matrix.node are still typed — exclude is not a key
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
## Permissions
|
|
446
|
-
|
|
447
|
-
Type-safe workflow and job permissions:
|
|
448
|
-
|
|
449
|
-
```ts
|
|
450
|
-
import { workflow } from "gagen";
|
|
451
|
-
|
|
452
|
-
const wf = workflow({
|
|
453
|
-
name: "ci",
|
|
454
|
-
on: ["push", "pull_request"],
|
|
455
|
-
permissions: { contents: "read", packages: "write" },
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
// or use a scalar value
|
|
459
|
-
const wf2 = workflow({
|
|
460
|
-
name: "ci",
|
|
461
|
-
on: ["push", "pull_request"],
|
|
462
|
-
permissions: "read-all",
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
// job-level permissions
|
|
466
|
-
workflow({
|
|
467
|
-
...,
|
|
468
|
-
jobs: [
|
|
469
|
-
{
|
|
470
|
-
id: "deploy",
|
|
471
|
-
runsOn: "ubuntu-latest",
|
|
472
|
-
permissions: { contents: "read", "id-token": "write" },
|
|
473
|
-
steps: [deploy],
|
|
474
|
-
},
|
|
475
|
-
],
|
|
476
|
-
});
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
Permission scopes (`contents`, `packages`, `id-token`, etc.) and levels (`read`,
|
|
480
|
-
`write`, `none`) are fully typed.
|
|
481
|
-
|
|
482
466
|
## Artifacts
|
|
483
467
|
|
|
484
468
|
Link upload and download artifact steps across jobs with automatic `needs`
|
|
@@ -507,10 +491,10 @@ const wf = workflow({
|
|
|
507
491
|
runsOn: "ubuntu-latest",
|
|
508
492
|
steps: [
|
|
509
493
|
buildOutput.download({ dirPath: "output/" }),
|
|
510
|
-
|
|
494
|
+
{
|
|
511
495
|
name: "Deploy",
|
|
512
496
|
run: "make deploy",
|
|
513
|
-
}
|
|
497
|
+
},
|
|
514
498
|
],
|
|
515
499
|
},
|
|
516
500
|
],
|
|
@@ -528,49 +512,3 @@ const buildOutput = artifact("build-output", {
|
|
|
528
512
|
retentionDays: 5,
|
|
529
513
|
});
|
|
530
514
|
```
|
|
531
|
-
|
|
532
|
-
## Job configuration
|
|
533
|
-
|
|
534
|
-
```ts
|
|
535
|
-
const matrix = defineMatrix({
|
|
536
|
-
include: [
|
|
537
|
-
{ runner: "ubuntu-latest" },
|
|
538
|
-
{ runner: "macos-latest" },
|
|
539
|
-
],
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
workflow({
|
|
543
|
-
...,
|
|
544
|
-
jobs: [
|
|
545
|
-
{
|
|
546
|
-
id: "build",
|
|
547
|
-
name: "Build",
|
|
548
|
-
runsOn: matrix.runner,
|
|
549
|
-
timeoutMinutes: 60,
|
|
550
|
-
defaults: { run: { shell: "bash" } },
|
|
551
|
-
env: { CARGO_TERM_COLOR: "always" },
|
|
552
|
-
permissions: { contents: "read" },
|
|
553
|
-
concurrency: { group: "build-${{ github.ref }}", cancelInProgress: true },
|
|
554
|
-
strategy: { matrix, failFast: true },
|
|
555
|
-
steps: [test],
|
|
556
|
-
},
|
|
557
|
-
],
|
|
558
|
-
});
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
## Step configuration
|
|
562
|
-
|
|
563
|
-
```ts
|
|
564
|
-
step({
|
|
565
|
-
name: "Deploy",
|
|
566
|
-
id: "deploy",
|
|
567
|
-
uses: "actions/deploy@v1",
|
|
568
|
-
with: { token: "${{ secrets.GITHUB_TOKEN }}" },
|
|
569
|
-
env: { NODE_ENV: "production" },
|
|
570
|
-
if: "github.ref == 'refs/heads/main'",
|
|
571
|
-
shell: "bash",
|
|
572
|
-
workingDirectory: "./app",
|
|
573
|
-
continueOnError: true,
|
|
574
|
-
timeoutMinutes: 10,
|
|
575
|
-
});
|
|
576
|
-
```
|
package/esm/_dnt.polyfills.d.ts
CHANGED
|
@@ -1,3 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
import { type URL } from "node:url";
|
|
15
|
+
declare global {
|
|
16
|
+
interface ImportMeta {
|
|
17
|
+
/** A string representation of the fully qualified module URL. When the
|
|
18
|
+
* module is loaded locally, the value will be a file URL (e.g.
|
|
19
|
+
* `file:///path/module.ts`).
|
|
20
|
+
*
|
|
21
|
+
* You can also parse the string as a URL to determine more information about
|
|
22
|
+
* how the current module was loaded. For example to determine if a module was
|
|
23
|
+
* local or not:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const url = new URL(import.meta.url);
|
|
27
|
+
* if (url.protocol === "file:") {
|
|
28
|
+
* console.log("this module was loaded locally");
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* A function that returns resolved specifier as if it would be imported
|
|
35
|
+
* using `import(specifier)`.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* console.log(import.meta.resolve("./foo.js"));
|
|
39
|
+
* // file:///dev/foo.js
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param specifier The module specifier to resolve relative to `parent`.
|
|
43
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
44
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
45
|
+
*/
|
|
46
|
+
resolve(specifier: string, parent?: string | URL | undefined): string;
|
|
47
|
+
/** A flag that indicates if the current module is the main module that was
|
|
48
|
+
* called when starting the program under Deno.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* if (import.meta.main) {
|
|
52
|
+
* // this was loaded as the main module, maybe do some bootstrapping
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
main: boolean;
|
|
57
|
+
/** The absolute path of the current module.
|
|
58
|
+
*
|
|
59
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```
|
|
63
|
+
* // Unix
|
|
64
|
+
* console.log(import.meta.filename); // /home/alice/my_module.ts
|
|
65
|
+
*
|
|
66
|
+
* // Windows
|
|
67
|
+
* console.log(import.meta.filename); // C:\alice\my_module.ts
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
filename: string;
|
|
71
|
+
/** The absolute path of the directory containing the current module.
|
|
72
|
+
*
|
|
73
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
74
|
+
*
|
|
75
|
+
* * Example:
|
|
76
|
+
* ```
|
|
77
|
+
* // Unix
|
|
78
|
+
* console.log(import.meta.dirname); // /home/alice
|
|
79
|
+
*
|
|
80
|
+
* // Windows
|
|
81
|
+
* console.log(import.meta.dirname); // C:\alice
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
dirname: string;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
type NodeRequest = ReturnType<typeof createRequire>;
|
|
88
|
+
type NodeModule = NonNullable<NodeRequest["main"]>;
|
|
89
|
+
interface ImportMetaPonyfillCommonjs {
|
|
90
|
+
(require: NodeRequest, module: NodeModule): ImportMeta;
|
|
91
|
+
}
|
|
92
|
+
interface ImportMetaPonyfillEsmodule {
|
|
93
|
+
(importMeta: ImportMeta): ImportMeta;
|
|
94
|
+
}
|
|
95
|
+
interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
|
|
96
|
+
}
|
|
97
|
+
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
98
|
+
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
99
|
+
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
1
100
|
declare global {
|
|
2
101
|
interface Object {
|
|
3
102
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC;AAgBxB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd;;;;WAIG;QACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;KAC5C;CACF;AAED,OAAO,EAAE,CAAC"}
|
package/esm/_dnt.polyfills.js
CHANGED
|
@@ -1,3 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
//@ts-ignore
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
//@ts-ignore
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
import { dirname } from "node:path";
|
|
19
|
+
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
20
|
+
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
21
|
+
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
22
|
+
configurable: true,
|
|
23
|
+
get() {
|
|
24
|
+
return fn;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export let import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
30
|
+
(() => {
|
|
31
|
+
const moduleImportMetaWM = new WeakMap();
|
|
32
|
+
return (require, module) => {
|
|
33
|
+
let importMetaCache = moduleImportMetaWM.get(module);
|
|
34
|
+
if (importMetaCache == null) {
|
|
35
|
+
const importMeta = Object.assign(Object.create(null), {
|
|
36
|
+
url: pathToFileURL(module.filename).href,
|
|
37
|
+
main: require.main == module,
|
|
38
|
+
resolve: (specifier, parentURL = importMeta.url) => {
|
|
39
|
+
return pathToFileURL((importMeta.url === parentURL
|
|
40
|
+
? require
|
|
41
|
+
: createRequire(parentURL))
|
|
42
|
+
.resolve(specifier)).href;
|
|
43
|
+
},
|
|
44
|
+
filename: module.filename,
|
|
45
|
+
dirname: module.path,
|
|
46
|
+
});
|
|
47
|
+
moduleImportMetaWM.set(module, importMeta);
|
|
48
|
+
importMetaCache = importMeta;
|
|
49
|
+
}
|
|
50
|
+
return importMetaCache;
|
|
51
|
+
};
|
|
52
|
+
})());
|
|
53
|
+
defineGlobalPonyfill("import-meta-ponyfill-commonjs", import_meta_ponyfill_commonjs);
|
|
54
|
+
export let import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
55
|
+
((importMeta) => {
|
|
56
|
+
const resolveFunStr = String(importMeta.resolve);
|
|
57
|
+
const shimWs = new WeakSet();
|
|
58
|
+
//@ts-ignore
|
|
59
|
+
const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
|
|
60
|
+
.replace(/\/{3,}/, "///");
|
|
61
|
+
const commonShim = (importMeta) => {
|
|
62
|
+
if (typeof importMeta.main !== "boolean") {
|
|
63
|
+
importMeta.main = importMeta.url === mainUrl;
|
|
64
|
+
}
|
|
65
|
+
if (typeof importMeta.filename !== "string") {
|
|
66
|
+
importMeta.filename = fileURLToPath(importMeta.url);
|
|
67
|
+
importMeta.dirname = dirname(importMeta.filename);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (
|
|
71
|
+
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
72
|
+
resolveFunStr === "undefined" ||
|
|
73
|
+
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
74
|
+
resolveFunStr.startsWith("async")
|
|
75
|
+
// enable by --experimental-import-meta-resolve flag
|
|
76
|
+
) {
|
|
77
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
78
|
+
if (!shimWs.has(importMeta)) {
|
|
79
|
+
shimWs.add(importMeta);
|
|
80
|
+
const importMetaUrlRequire = {
|
|
81
|
+
url: importMeta.url,
|
|
82
|
+
require: createRequire(importMeta.url),
|
|
83
|
+
};
|
|
84
|
+
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
85
|
+
return pathToFileURL((importMetaUrlRequire.url === parentURL
|
|
86
|
+
? importMetaUrlRequire.require
|
|
87
|
+
: createRequire(parentURL)).resolve(specifier)).href;
|
|
88
|
+
};
|
|
89
|
+
commonShim(importMeta);
|
|
90
|
+
}
|
|
91
|
+
return importMeta;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
/// native support
|
|
96
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
97
|
+
if (!shimWs.has(importMeta)) {
|
|
98
|
+
shimWs.add(importMeta);
|
|
99
|
+
commonShim(importMeta);
|
|
100
|
+
}
|
|
101
|
+
return importMeta;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return import_meta_ponyfill_esmodule(importMeta);
|
|
105
|
+
}));
|
|
106
|
+
defineGlobalPonyfill("import-meta-ponyfill-esmodule", import_meta_ponyfill_esmodule);
|
|
107
|
+
export let import_meta_ponyfill = ((...args) => {
|
|
108
|
+
const _MODULE = (() => {
|
|
109
|
+
if (typeof require === "function" && typeof module === "object") {
|
|
110
|
+
return "commonjs";
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// eval("typeof import.meta");
|
|
114
|
+
return "esmodule";
|
|
115
|
+
}
|
|
116
|
+
})();
|
|
117
|
+
if (_MODULE === "commonjs") {
|
|
118
|
+
//@ts-ignore
|
|
119
|
+
import_meta_ponyfill = (r, m) => import_meta_ponyfill_commonjs(r, m);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
//@ts-ignore
|
|
123
|
+
import_meta_ponyfill = (im) => import_meta_ponyfill_esmodule(im);
|
|
124
|
+
}
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
return import_meta_ponyfill(...args);
|
|
127
|
+
});
|
|
1
128
|
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
2
129
|
if (!Object.hasOwn) {
|
|
3
130
|
Object.defineProperty(Object, "hasOwn", {
|
|
@@ -12,4 +139,3 @@ if (!Object.hasOwn) {
|
|
|
12
139
|
writable: true,
|
|
13
140
|
});
|
|
14
141
|
}
|
|
15
|
-
export {};
|
package/esm/cli.d.ts
ADDED
package/esm/cli.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,qBAAqB,CAAC;AAO7B,wBAAsB,MAAM,kBAkC3B"}
|
package/esm/cli.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./_dnt.polyfills.js";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
import { collectActionVersions, pullVersionsInSource } from "./pin.js";
|
|
8
|
+
export async function runCli() {
|
|
9
|
+
const workflowsDir = findWorkflowsDir();
|
|
10
|
+
if (workflowsDir == null) {
|
|
11
|
+
console.error("No .github/workflows directory found.");
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
if (process.argv.includes("--pull-versions")) {
|
|
15
|
+
pullVersions(workflowsDir);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const entries = fs.readdirSync(workflowsDir);
|
|
19
|
+
const extensions = [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"];
|
|
20
|
+
const tsFiles = entries
|
|
21
|
+
.filter((f) => extensions.some((ext) => f.endsWith(ext)))
|
|
22
|
+
.sort();
|
|
23
|
+
if (tsFiles.length === 0) {
|
|
24
|
+
console.error("No script files found in .github/workflows");
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const isLinting = process.argv.includes("--lint");
|
|
28
|
+
for (const file of tsFiles) {
|
|
29
|
+
const fullPath = resolve(workflowsDir, file);
|
|
30
|
+
const content = fs.readFileSync(fullPath, "utf8");
|
|
31
|
+
if (!content.includes("writeOrLint"))
|
|
32
|
+
continue;
|
|
33
|
+
const label = isLinting ? "Linting" : "Generating";
|
|
34
|
+
const color = isLinting ? "\x1b[36m" : "\x1b[32m";
|
|
35
|
+
console.error(`${color}${label}\x1b[0m ${file}`);
|
|
36
|
+
await import(pathToFileURL(fullPath).href);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function pullVersions(workflowsDir) {
|
|
40
|
+
const entries = fs.readdirSync(workflowsDir);
|
|
41
|
+
const yamlFiles = entries.filter((f) => f.endsWith(".yml") || f.endsWith(".yaml"));
|
|
42
|
+
const yamlContents = yamlFiles.map((f) => fs.readFileSync(resolve(workflowsDir, f), "utf8"));
|
|
43
|
+
const { versions, conflicts } = collectActionVersions(yamlContents);
|
|
44
|
+
for (const [action, refs] of conflicts) {
|
|
45
|
+
console.error(`\x1b[33mwarning\x1b[0m ${action}: conflicting versions ${refs.join(", ")} — skipping`);
|
|
46
|
+
}
|
|
47
|
+
if (versions.size === 0) {
|
|
48
|
+
if (conflicts.size === 0) {
|
|
49
|
+
console.error("No pinned versions found in generated YAML files.");
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const scriptExtensions = [".ts", ".js", ".mts", ".mjs", ".cts", ".cjs"];
|
|
54
|
+
const scriptFiles = entries
|
|
55
|
+
.filter((f) => scriptExtensions.some((ext) => f.endsWith(ext)))
|
|
56
|
+
.sort();
|
|
57
|
+
let anyChanges = false;
|
|
58
|
+
for (const file of scriptFiles) {
|
|
59
|
+
const fullPath = resolve(workflowsDir, file);
|
|
60
|
+
const content = fs.readFileSync(fullPath, "utf8");
|
|
61
|
+
const { content: updated, changes } = pullVersionsInSource(content, versions);
|
|
62
|
+
if (changes.length === 0)
|
|
63
|
+
continue;
|
|
64
|
+
anyChanges = true;
|
|
65
|
+
fs.writeFileSync(fullPath, updated);
|
|
66
|
+
for (const change of changes) {
|
|
67
|
+
console.error(`\x1b[32mupdated\x1b[0m ${file}: ${change.action}@${change.from} → ${change.to}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!anyChanges) {
|
|
71
|
+
console.error("All script files are already up to date.");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function findWorkflowsDir() {
|
|
75
|
+
let dir = resolve(".");
|
|
76
|
+
while (true) {
|
|
77
|
+
const candidate = join(dir, ".github", "workflows");
|
|
78
|
+
if (fs.existsSync(candidate))
|
|
79
|
+
return candidate;
|
|
80
|
+
const parent = dirname(dir);
|
|
81
|
+
if (parent === dir)
|
|
82
|
+
return undefined;
|
|
83
|
+
dir = parent;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).main) {
|
|
87
|
+
await runCli();
|
|
88
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_message.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.
|
|
1
|
+
{"version":3,"file":"build_message.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.13/build_message.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,QAAQ;AAClB;;;GAGG;AACH,UAAU,UAAQ,GACjB,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAWvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CASrD;AAED,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAC7C,OAAO,GAAE,mBAAwB,EACjC,YAAY,CAAC,EAAE,CACb,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAC7C,UAAU,EAAE,OAAO,EACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,KAC1B,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GACrC,MAAM,EAAE,CA8BV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.13/diff.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAanD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAWvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,CAAC,EAAE,CAAC,EAAE,EACN,CAAC,EAAE,CAAC,EAAE,EACN,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,WAAW,EACnB,kBAAkB,EAAE,MAAM,GACzB,KAAK,CAAC;IACP,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,CAAC,CAAC;CACV,CAAC,CAgCD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,QAAQ,CACtB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,WAAW,EACnB,kBAAkB,EAAE,MAAM,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,aAAa,EACrB,IAAI,CAAC,EAAE,aAAa,GACnB,aAAa,CAsBf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAwEvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff_str.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.
|
|
1
|
+
{"version":3,"file":"diff_str.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.13/diff_str.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAqB,UAAU,EAAE,MAAM,YAAY,CAAC;AAGhE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAY/C;AAKD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,MAAM,EAAE,CAiBnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,EACxB,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,GAC3B,UAAU,CAAC,MAAM,CAAC,EAAE,CAetB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,EAAE,CAkDlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.13/format.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,GAAG,CACtB,CAAC,EAAE,OAAO,EACV,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,KACE,MAAM,CAAC;AAEZ;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAmBzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.13/styles.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAWD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.13/types.ts"],"names":[],"mappings":"AAGA,kDAAkD;AAClD,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;CAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_chars.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.1.0/_chars.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG,QAAS,CAAC;AAC1B,eAAO,MAAM,GAAG,IAAO,CAAC;AACxB,eAAO,MAAM,S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ateOptions {
|
|
|
26
26
|
* if first argument is less than second argument, zero if they're equal
|
|
27
27
|
* and a positive value otherwise.
|
|
28
28
|
*/
|
|
29
|
-
sortKeys?: boolean | ((a: string, b: string) => number);
|
|
29
|
+
sortKeys?: boolean | ((a: string, b: string, depth: number) => number);
|
|
30
30
|
/** set max line width. (default: 80) */
|
|
31
31
|
lineWidth?: number;
|
|
32
32
|
/**
|
|
@@ -59,7 +59,7 @@ export declare class DumperState {
|
|
|
59
59
|
arrayIndent: boolean;
|
|
60
60
|
skipInvalid: boolean;
|
|
61
61
|
flowLevel: number;
|
|
62
|
-
sortKeys: boolean | ((a: string, b: string) => number);
|
|
62
|
+
sortKeys: boolean | ((a: string, b: string, depth: number) => number);
|
|
63
63
|
lineWidth: number;
|
|
64
64
|
useAnchors: boolean;
|
|
65
65
|
compatMode: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dumper_state.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AA2X/D,MAAM,WAAW,kBAAkB;IACjC,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAA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E,OAAO,CAAC;QACjB,KAAK,EAAE,OAAO,CAAC;KAChB,GAAG,MAAM,GAAG,IAAI;IAiEjB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAiBlC"}
|
|
@@ -561,7 +561,8 @@ export class DumperState {
|
|
|
561
561
|
}
|
|
562
562
|
else if (typeof this.sortKeys === "function") {
|
|
563
563
|
// Custom sort function
|
|
564
|
-
|
|
564
|
+
const sortKeys = this.sortKeys;
|
|
565
|
+
keys.sort((a, b) => sortKeys(a, b, level));
|
|
565
566
|
}
|
|
566
567
|
else if (this.sortKeys) {
|
|
567
568
|
// Something is wrong
|