@napi-rs/cli 3.0.0-alpha.23 → 3.0.0-alpha.25
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/api/build.js +3 -3
- package/dist/api/build.js.map +1 -1
- package/dist/api/create-npm-dirs.js +8 -5
- package/dist/api/create-npm-dirs.js.map +1 -1
- package/dist/api/new.js +17 -9
- package/dist/api/new.js.map +1 -1
- package/dist/api/pre-publish.js +5 -4
- package/dist/api/pre-publish.js.map +1 -1
- package/dist/api/rename.js +1 -1
- package/dist/api/rename.js.map +1 -1
- package/dist/api/templates/ci-template.d.ts +2 -1
- package/dist/api/templates/ci-template.js +102 -110
- package/dist/api/templates/ci-template.js.map +1 -1
- package/dist/api/templates/ci.yml.d.ts +2 -1
- package/dist/api/templates/ci.yml.js +10 -2
- package/dist/api/templates/ci.yml.js.map +1 -1
- package/dist/api/templates/js-binding.js +15 -0
- package/dist/api/templates/js-binding.js.map +1 -1
- package/dist/api/templates/load-wasi-template.js.map +1 -0
- package/dist/api/templates/package.json.d.ts +4 -2
- package/dist/api/templates/package.json.js +28 -4
- package/dist/api/templates/package.json.js.map +1 -1
- package/dist/api/templates/wasi-worker-template.js.map +1 -0
- package/dist/api/universalize.js +2 -2
- package/dist/api/universalize.js.map +1 -1
- package/dist/api/version.js +1 -1
- package/dist/api/version.js.map +1 -1
- package/dist/commands/artifacts.js +2 -2
- package/dist/commands/artifacts.js.map +1 -1
- package/dist/commands/build.js +1 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/new.js +13 -3
- package/dist/commands/new.js.map +1 -1
- package/dist/def/artifacts.js +1 -1
- package/dist/def/artifacts.js.map +1 -1
- package/dist/def/new.d.ts +22 -4
- package/dist/def/new.js +11 -1
- package/dist/def/new.js.map +1 -1
- package/dist/index.cjs +319 -268
- package/dist/utils/cargo.js +1 -1
- package/dist/utils/cargo.js.map +1 -1
- package/dist/utils/config.d.ts +8 -0
- package/dist/utils/config.js +2 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/metadata.js +2 -2
- package/dist/utils/metadata.js.map +1 -1
- package/dist/utils/misc.d.ts +1 -1
- package/dist/utils/misc.js +3 -3
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/target.d.ts +7 -4
- package/dist/utils/target.js +6 -1
- package/dist/utils/target.js.map +1 -1
- package/package.json +2 -2
- package/src/api/build.ts +3 -3
- package/src/api/create-npm-dirs.ts +9 -5
- package/src/api/new.ts +34 -21
- package/src/api/pre-publish.ts +6 -4
- package/src/api/rename.ts +1 -1
- package/src/api/templates/ci-template.ts +104 -110
- package/src/api/templates/ci.yml.ts +14 -2
- package/src/api/templates/js-binding.ts +15 -0
- package/src/api/templates/package.json.ts +51 -5
- package/src/api/universalize.ts +2 -2
- package/src/api/version.ts +1 -1
- package/src/commands/artifacts.ts +2 -2
- package/src/commands/build.ts +1 -1
- package/src/commands/new.ts +13 -3
- package/src/def/artifacts.ts +1 -1
- package/src/def/new.ts +27 -2
- package/src/utils/__tests__/__snapshots__/target.spec.ts.md +7 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
- package/src/utils/cargo.ts +1 -1
- package/src/utils/config.ts +16 -0
- package/src/utils/metadata.ts +2 -2
- package/src/utils/misc.ts +11 -3
- package/src/utils/target.ts +9 -2
- package/dist/api/load-wasi-template.js.map +0 -1
- package/dist/api/wasi-worker-template.js.map +0 -1
- /package/dist/api/{load-wasi-template.d.ts → templates/load-wasi-template.d.ts} +0 -0
- /package/dist/api/{load-wasi-template.js → templates/load-wasi-template.js} +0 -0
- /package/dist/api/{wasi-worker-template.d.ts → templates/wasi-worker-template.d.ts} +0 -0
- /package/dist/api/{wasi-worker-template.js → templates/wasi-worker-template.js} +0 -0
- /package/src/api/{load-wasi-template.ts → templates/load-wasi-template.ts} +0 -0
- /package/src/api/{wasi-worker-template.ts → templates/wasi-worker-template.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const YAML = () => `
|
|
1
|
+
export const YAML = (packageManager) => `
|
|
2
2
|
name: CI
|
|
3
3
|
|
|
4
4
|
env:
|
|
@@ -32,82 +32,53 @@ jobs:
|
|
|
32
32
|
settings:
|
|
33
33
|
- host: macos-latest
|
|
34
34
|
target: 'x86_64-apple-darwin'
|
|
35
|
-
build:
|
|
36
|
-
yarn build --platform
|
|
37
|
-
strip -x *.node
|
|
35
|
+
build: ${packageManager} build --platform
|
|
38
36
|
- host: windows-latest
|
|
39
|
-
build:
|
|
37
|
+
build: ${packageManager} build --platform
|
|
40
38
|
target: 'x86_64-pc-windows-msvc'
|
|
41
39
|
- host: windows-latest
|
|
42
40
|
build: |
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
${packageManager} build --platform --target i686-pc-windows-msvc
|
|
42
|
+
${packageManager} test
|
|
45
43
|
target: 'i686-pc-windows-msvc'
|
|
46
44
|
- host: ubuntu-latest
|
|
47
45
|
target: 'x86_64-unknown-linux-gnu'
|
|
48
|
-
|
|
49
|
-
build: >-
|
|
50
|
-
set -e &&\n
|
|
51
|
-
yarn build --platform --target x86_64-unknown-linux-gnu &&\n
|
|
52
|
-
strip *.node
|
|
46
|
+
build: ${packageManager} build --platform --target x86_64-unknown-linux-gnu --use-napi-cross
|
|
53
47
|
- host: ubuntu-latest
|
|
54
48
|
target: 'x86_64-unknown-linux-musl'
|
|
55
|
-
|
|
56
|
-
build: >-
|
|
57
|
-
set -e &&
|
|
58
|
-
yarn build --platform &&
|
|
59
|
-
strip *.node
|
|
49
|
+
build: ${packageManager} build --platform --target x86_64-unknown-linux-musl -x
|
|
60
50
|
- host: macos-latest
|
|
61
51
|
target: 'aarch64-apple-darwin'
|
|
62
|
-
build:
|
|
63
|
-
yarn build --platform --target aarch64-apple-darwin
|
|
64
|
-
strip -x *.node
|
|
52
|
+
build: ${packageManager} build --platform --target aarch64-apple-darwin
|
|
65
53
|
- host: ubuntu-latest
|
|
66
54
|
target: 'aarch64-unknown-linux-gnu'
|
|
67
|
-
|
|
68
|
-
build: >-
|
|
69
|
-
set -e &&\n
|
|
70
|
-
yarn build --platform --target aarch64-unknown-linux-gnu &&\n
|
|
71
|
-
aarch64-unknown-linux-gnu-strip *.node
|
|
55
|
+
build: ${packageManager} build --platform --target aarch64-unknown-linux-gnu --use-napi-cross
|
|
72
56
|
- host: ubuntu-latest
|
|
73
57
|
target: 'armv7-unknown-linux-gnueabihf'
|
|
74
|
-
|
|
75
|
-
sudo apt-get update
|
|
76
|
-
sudo apt-get install gcc-arm-linux-gnueabihf -y
|
|
77
|
-
build: |
|
|
78
|
-
yarn build --platform --target armv7-unknown-linux-gnueabihf --cross-compile
|
|
79
|
-
arm-linux-gnueabihf-strip *.node
|
|
58
|
+
build: ${packageManager} build --platform --target armv7-unknown-linux-gnueabihf --use-napi-cross
|
|
80
59
|
- host: ubuntu-latest
|
|
81
60
|
target: 'aarch64-linux-android'
|
|
82
|
-
build:
|
|
83
|
-
yarn build --platform --target aarch64-linux-android
|
|
84
|
-
\${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
|
|
61
|
+
build: ${packageManager} build --platform --target aarch64-linux-android
|
|
85
62
|
- host: ubuntu-latest
|
|
86
63
|
target: 'armv7-linux-androideabi'
|
|
87
|
-
build:
|
|
88
|
-
yarn build --platform --target armv7-linux-androideabi
|
|
89
|
-
\${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip *.node
|
|
64
|
+
build: ${packageManager} build --platform --target armv7-linux-androideabi
|
|
90
65
|
- host: ubuntu-latest
|
|
91
66
|
target: 'aarch64-unknown-linux-musl'
|
|
92
|
-
|
|
93
|
-
build: >-
|
|
94
|
-
set -e &&\n
|
|
95
|
-
rustup target add aarch64-unknown-linux-musl &&\n
|
|
96
|
-
yarn build --platform --target aarch64-unknown-linux-musl &&\n
|
|
97
|
-
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
|
|
67
|
+
build: ${packageManager} build --platform --target aarch64-unknown-linux-musl -x
|
|
98
68
|
- host: windows-latest
|
|
99
69
|
target: 'aarch64-pc-windows-msvc'
|
|
100
|
-
build:
|
|
70
|
+
build: ${packageManager} build --platform --target aarch64-pc-windows-msvc
|
|
101
71
|
- host: ubuntu-latest
|
|
102
72
|
target: 'riscv64gc-unknown-linux-gnu'
|
|
103
73
|
setup: |
|
|
104
74
|
sudo apt-get update
|
|
105
75
|
sudo apt-get install gcc-riscv64-linux-gnu -y
|
|
106
|
-
build:
|
|
107
|
-
|
|
108
|
-
|
|
76
|
+
build: ${packageManager} build --platform --target riscv64gc-unknown-linux-gnu
|
|
77
|
+
- host: ubuntu-latest
|
|
78
|
+
target: 'wasm32-wasi-preview1-threads'
|
|
79
|
+
build: ${packageManager} build --platform --target wasm32-wasi-preview1-threads
|
|
109
80
|
|
|
110
|
-
name: stable - \${{ matrix.settings.target }} - node@
|
|
81
|
+
name: stable - \${{ matrix.settings.target }} - node@20
|
|
111
82
|
runs-on: \${{ matrix.settings.host }}
|
|
112
83
|
|
|
113
84
|
steps:
|
|
@@ -115,14 +86,12 @@ jobs:
|
|
|
115
86
|
|
|
116
87
|
- name: Setup node
|
|
117
88
|
uses: actions/setup-node@v4
|
|
118
|
-
if: \${{ !matrix.settings.docker }}
|
|
119
89
|
with:
|
|
120
|
-
node-version:
|
|
121
|
-
cache:
|
|
90
|
+
node-version: 20
|
|
91
|
+
cache: ${packageManager}
|
|
122
92
|
|
|
123
93
|
- name: Install
|
|
124
94
|
uses: dtolnay/rust-toolchain@stable
|
|
125
|
-
if: \${{ !matrix.settings.docker }}
|
|
126
95
|
with:
|
|
127
96
|
toolchain: stable
|
|
128
97
|
targets: \${{ matrix.settings.target }}
|
|
@@ -134,12 +103,13 @@ jobs:
|
|
|
134
103
|
~/.cargo/registry/index/
|
|
135
104
|
~/.cargo/registry/cache/
|
|
136
105
|
~/.cargo/git/db/
|
|
106
|
+
~/.napi-rs
|
|
137
107
|
.cargo-cache
|
|
138
108
|
target/
|
|
139
109
|
key: \${{ matrix.settings.target }}-cargo-\${{ matrix.settings.host }}
|
|
140
110
|
|
|
141
111
|
- uses: goto-bus-stop/setup-zig@v2
|
|
142
|
-
if: \${{ matrix.settings.target
|
|
112
|
+
if: \${{ contains(matrix.settings.target, 'musl') }}
|
|
143
113
|
with:
|
|
144
114
|
version: 0.11.0
|
|
145
115
|
|
|
@@ -154,36 +124,35 @@ jobs:
|
|
|
154
124
|
shell: bash
|
|
155
125
|
|
|
156
126
|
- name: 'Install dependencies'
|
|
157
|
-
run:
|
|
127
|
+
run: ${packageManager} install
|
|
158
128
|
|
|
159
129
|
- name: Setup node x86
|
|
160
130
|
uses: actions/setup-node@v4
|
|
161
131
|
if: matrix.settings.target == 'i686-pc-windows-msvc'
|
|
162
132
|
with:
|
|
163
|
-
node-version:
|
|
164
|
-
cache: yarn
|
|
133
|
+
node-version: 20
|
|
165
134
|
architecture: x86
|
|
166
135
|
|
|
167
|
-
- name: Build in docker
|
|
168
|
-
uses: addnab/docker-run-action@v3
|
|
169
|
-
if: \${{ matrix.settings.docker }}
|
|
170
|
-
with:
|
|
171
|
-
image: \${{ matrix.settings.docker }}
|
|
172
|
-
options: --user 0:0 -v \${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v \${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v \${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v \${{ github.workspace }}:/build -w /build
|
|
173
|
-
run: \${{ matrix.settings.build }}
|
|
174
|
-
|
|
175
136
|
- name: 'Build'
|
|
176
137
|
run: \${{ matrix.settings.build }}
|
|
177
|
-
if: \${{ !matrix.settings.docker }}
|
|
178
138
|
shell: bash
|
|
179
139
|
|
|
180
140
|
- name: Upload artifact
|
|
181
|
-
uses: actions/upload-artifact@
|
|
141
|
+
uses: actions/upload-artifact@v4
|
|
142
|
+
if: matrix.settings.target != 'wasm32-wasi-preview1-threads'
|
|
182
143
|
with:
|
|
183
144
|
name: bindings-\${{ matrix.settings.target }}
|
|
184
145
|
path: "*.node"
|
|
185
146
|
if-no-files-found: error
|
|
186
147
|
|
|
148
|
+
- name: Upload artifact
|
|
149
|
+
uses: actions/upload-artifact@v4
|
|
150
|
+
if: matrix.settings.target == 'wasm32-wasi-preview1-threads'
|
|
151
|
+
with:
|
|
152
|
+
name: bindings-\${{ matrix.settings.target }}
|
|
153
|
+
path: "*.wasm"
|
|
154
|
+
if-no-files-found: error
|
|
155
|
+
|
|
187
156
|
build-freebsd:
|
|
188
157
|
runs-on: macos-12
|
|
189
158
|
name: Build FreeBSD
|
|
@@ -191,7 +160,8 @@ jobs:
|
|
|
191
160
|
- uses: actions/checkout@v4
|
|
192
161
|
- name: Build
|
|
193
162
|
id: build
|
|
194
|
-
uses: cross-platform-actions/action@v0.21.
|
|
163
|
+
uses: cross-platform-actions/action@v0.21.1
|
|
164
|
+
timeout-minutes: 30
|
|
195
165
|
env:
|
|
196
166
|
DEBUG: 'napi:*'
|
|
197
167
|
RUSTUP_IO_THREADS: 1
|
|
@@ -202,9 +172,9 @@ jobs:
|
|
|
202
172
|
cpu_count: 3
|
|
203
173
|
environment_variables: 'DEBUG RUSTUP_IO_THREADS'
|
|
204
174
|
shell: bash
|
|
205
|
-
|
|
175
|
+
run: |
|
|
206
176
|
sudo pkg install -y -f curl node libnghttp2 npm
|
|
207
|
-
sudo npm install -g
|
|
177
|
+
sudo npm install -g ${packageManager} --ignore-scripts
|
|
208
178
|
curl https://sh.rustup.rs -sSf --output rustup.sh
|
|
209
179
|
sh rustup.sh -y --profile minimal --default-toolchain stable
|
|
210
180
|
source "$HOME/.cargo/env"
|
|
@@ -219,15 +189,15 @@ jobs:
|
|
|
219
189
|
whoami
|
|
220
190
|
env
|
|
221
191
|
freebsd-version
|
|
222
|
-
|
|
223
|
-
|
|
192
|
+
${packageManager} install
|
|
193
|
+
${packageManager} build
|
|
224
194
|
strip -x *.node
|
|
225
195
|
yarn test
|
|
226
196
|
rm -rf node_modules
|
|
227
197
|
rm -rf target
|
|
228
198
|
rm -rf .yarn/cache
|
|
229
199
|
- name: Upload artifact
|
|
230
|
-
uses: actions/upload-artifact@
|
|
200
|
+
uses: actions/upload-artifact@v4
|
|
231
201
|
with:
|
|
232
202
|
name: bindings-freebsd
|
|
233
203
|
path: "*.node"
|
|
@@ -255,13 +225,13 @@ jobs:
|
|
|
255
225
|
uses: actions/setup-node@v4
|
|
256
226
|
with:
|
|
257
227
|
node-version: \${{ matrix.node }}
|
|
258
|
-
cache: '
|
|
228
|
+
cache: '${packageManager}'
|
|
259
229
|
|
|
260
230
|
- name: 'Install dependencies'
|
|
261
|
-
run:
|
|
231
|
+
run: ${packageManager} install
|
|
262
232
|
|
|
263
233
|
- name: Download artifacts
|
|
264
|
-
uses: actions/download-artifact@
|
|
234
|
+
uses: actions/download-artifact@v4
|
|
265
235
|
with:
|
|
266
236
|
name: bindings-\${{ matrix.settings.target }}
|
|
267
237
|
path: .
|
|
@@ -271,7 +241,7 @@ jobs:
|
|
|
271
241
|
shell: bash
|
|
272
242
|
|
|
273
243
|
- name: Test bindings
|
|
274
|
-
run:
|
|
244
|
+
run: ${packageManager} test
|
|
275
245
|
|
|
276
246
|
test-linux-x64-gnu-binding:
|
|
277
247
|
name: Test bindings on Linux-x64-gnu - node@\${{ matrix.node }}
|
|
@@ -290,13 +260,13 @@ jobs:
|
|
|
290
260
|
uses: actions/setup-node@v4
|
|
291
261
|
with:
|
|
292
262
|
node-version: \${{ matrix.node }}
|
|
293
|
-
cache: '
|
|
263
|
+
cache: '${packageManager}'
|
|
294
264
|
|
|
295
265
|
- name: 'Install dependencies'
|
|
296
|
-
run:
|
|
266
|
+
run: ${packageManager} install
|
|
297
267
|
|
|
298
268
|
- name: Download artifacts
|
|
299
|
-
uses: actions/download-artifact@
|
|
269
|
+
uses: actions/download-artifact@v4
|
|
300
270
|
with:
|
|
301
271
|
name: bindings-x86_64-unknown-linux-gnu
|
|
302
272
|
path: .
|
|
@@ -330,10 +300,10 @@ jobs:
|
|
|
330
300
|
- name: 'Install dependencies'
|
|
331
301
|
run: |
|
|
332
302
|
yarn config set supportedArchitectures.libc "musl"
|
|
333
|
-
|
|
303
|
+
${packageManager} install
|
|
334
304
|
|
|
335
305
|
- name: Download artifacts
|
|
336
|
-
uses: actions/download-artifact@
|
|
306
|
+
uses: actions/download-artifact@v4
|
|
337
307
|
with:
|
|
338
308
|
name: bindings-x86_64-unknown-linux-musl
|
|
339
309
|
path: .
|
|
@@ -352,14 +322,14 @@ jobs:
|
|
|
352
322
|
strategy:
|
|
353
323
|
fail-fast: false
|
|
354
324
|
matrix:
|
|
355
|
-
node: ['
|
|
325
|
+
node: ['20']
|
|
356
326
|
runs-on: ubuntu-latest
|
|
357
327
|
|
|
358
328
|
steps:
|
|
359
329
|
- uses: actions/checkout@v4
|
|
360
330
|
|
|
361
331
|
- name: Download artifacts
|
|
362
|
-
uses: actions/download-artifact@
|
|
332
|
+
uses: actions/download-artifact@v4
|
|
363
333
|
with:
|
|
364
334
|
name: bindings-aarch64-unknown-linux-gnu
|
|
365
335
|
path: .
|
|
@@ -372,7 +342,7 @@ jobs:
|
|
|
372
342
|
run: |
|
|
373
343
|
yarn config set supportedArchitectures.cpu "arm64"
|
|
374
344
|
yarn config set supportedArchitectures.libc "glibc"
|
|
375
|
-
|
|
345
|
+
${packageManager} install
|
|
376
346
|
|
|
377
347
|
- name: Set up QEMU
|
|
378
348
|
uses: docker/setup-qemu-action@v3
|
|
@@ -385,10 +355,7 @@ jobs:
|
|
|
385
355
|
with:
|
|
386
356
|
image: node:\${{ matrix.node }}-slim
|
|
387
357
|
options: --platform linux/arm64 -v \${{ github.workspace }}:/build -w /build
|
|
388
|
-
run:
|
|
389
|
-
set -e
|
|
390
|
-
yarn test
|
|
391
|
-
ls -la
|
|
358
|
+
run: yarn test
|
|
392
359
|
|
|
393
360
|
test-linux-aarch64-musl-binding:
|
|
394
361
|
name: Test bindings on aarch64-unknown-linux-musl - node@\${{ matrix.node }}
|
|
@@ -405,7 +372,7 @@ jobs:
|
|
|
405
372
|
- uses: actions/checkout@v4
|
|
406
373
|
|
|
407
374
|
- name: Download artifacts
|
|
408
|
-
uses: actions/download-artifact@
|
|
375
|
+
uses: actions/download-artifact@v4
|
|
409
376
|
with:
|
|
410
377
|
name: bindings-aarch64-unknown-linux-musl
|
|
411
378
|
path: .
|
|
@@ -418,7 +385,7 @@ jobs:
|
|
|
418
385
|
run: |
|
|
419
386
|
yarn config set supportedArchitectures.cpu "arm64"
|
|
420
387
|
yarn config set supportedArchitectures.libc "musl"
|
|
421
|
-
|
|
388
|
+
${packageManager} install
|
|
422
389
|
|
|
423
390
|
- name: Set up QEMU
|
|
424
391
|
uses: docker/setup-qemu-action@v3
|
|
@@ -431,9 +398,7 @@ jobs:
|
|
|
431
398
|
with:
|
|
432
399
|
image: node:\${{ matrix.node }}-alpine
|
|
433
400
|
options: --platform linux/arm64 -v \${{ github.workspace }}:/build -w /build
|
|
434
|
-
run:
|
|
435
|
-
set -e
|
|
436
|
-
yarn test
|
|
401
|
+
run: yarn test
|
|
437
402
|
|
|
438
403
|
test-linux-arm-gnueabihf-binding:
|
|
439
404
|
name: Test bindings on armv7-unknown-linux-gnueabihf - node@\${{ matrix.node }}
|
|
@@ -449,7 +414,7 @@ jobs:
|
|
|
449
414
|
- uses: actions/checkout@v4
|
|
450
415
|
|
|
451
416
|
- name: Download artifacts
|
|
452
|
-
uses: actions/download-artifact@
|
|
417
|
+
uses: actions/download-artifact@v4
|
|
453
418
|
with:
|
|
454
419
|
name: bindings-armv7-unknown-linux-gnueabihf
|
|
455
420
|
path: .
|
|
@@ -461,7 +426,7 @@ jobs:
|
|
|
461
426
|
- name: Install dependencies
|
|
462
427
|
run: |
|
|
463
428
|
yarn config set supportedArchitectures.cpu "arm"
|
|
464
|
-
|
|
429
|
+
${packageManager} install
|
|
465
430
|
|
|
466
431
|
- name: Set up QEMU
|
|
467
432
|
uses: docker/setup-qemu-action@v3
|
|
@@ -474,10 +439,7 @@ jobs:
|
|
|
474
439
|
with:
|
|
475
440
|
image: node:\${{ matrix.node }}-bullseye-slim
|
|
476
441
|
options: --platform linux/arm/v7 -v \${{ github.workspace }}:/build -w /build
|
|
477
|
-
run:
|
|
478
|
-
set -e
|
|
479
|
-
yarn test
|
|
480
|
-
ls -la
|
|
442
|
+
run: ${packageManager} test
|
|
481
443
|
|
|
482
444
|
universal-macOS:
|
|
483
445
|
name: Build universal macOS binary
|
|
@@ -491,33 +453,62 @@ jobs:
|
|
|
491
453
|
- name: Setup node
|
|
492
454
|
uses: actions/setup-node@v4
|
|
493
455
|
with:
|
|
494
|
-
node-version:
|
|
495
|
-
cache:
|
|
456
|
+
node-version: 20
|
|
457
|
+
cache: ${packageManager}
|
|
496
458
|
|
|
497
459
|
- name: 'Install dependencies'
|
|
498
|
-
run:
|
|
460
|
+
run: ${packageManager} install
|
|
499
461
|
|
|
500
462
|
- name: Download macOS x64 artifact
|
|
501
|
-
uses: actions/download-artifact@
|
|
463
|
+
uses: actions/download-artifact@v4
|
|
502
464
|
with:
|
|
503
465
|
name: bindings-x86_64-apple-darwin
|
|
504
466
|
path: .
|
|
505
467
|
- name: Download macOS arm64 artifact
|
|
506
|
-
uses: actions/download-artifact@
|
|
468
|
+
uses: actions/download-artifact@v4
|
|
507
469
|
with:
|
|
508
470
|
name: bindings-aarch64-apple-darwin
|
|
509
471
|
path: .
|
|
510
472
|
|
|
511
473
|
- name: Combine binaries
|
|
512
|
-
run:
|
|
474
|
+
run: ${packageManager} napi universalize
|
|
513
475
|
|
|
514
476
|
- name: Upload artifact
|
|
515
|
-
uses: actions/upload-artifact@
|
|
477
|
+
uses: actions/upload-artifact@v4
|
|
516
478
|
with:
|
|
517
479
|
name: bindings-universal-apple-darwin
|
|
518
480
|
path: "*.node"
|
|
519
481
|
if-no-files-found: error
|
|
520
482
|
|
|
483
|
+
test-wasi-nodejs:
|
|
484
|
+
name: Test bindings on wasi - node@\${{ matrix.node }}
|
|
485
|
+
needs:
|
|
486
|
+
- build
|
|
487
|
+
strategy:
|
|
488
|
+
fail-fast: false
|
|
489
|
+
matrix:
|
|
490
|
+
node: ['18', '20']
|
|
491
|
+
runs-on: ubuntu-latest
|
|
492
|
+
steps:
|
|
493
|
+
- uses: actions/checkout@v4
|
|
494
|
+
- name: Download artifacts
|
|
495
|
+
uses: actions/download-artifact@v4
|
|
496
|
+
with:
|
|
497
|
+
name: bindings-wasm32-wasi-preview1-threads
|
|
498
|
+
path: .
|
|
499
|
+
- name: List packages
|
|
500
|
+
run: ls -R .
|
|
501
|
+
- uses: actions/setup-node@v4
|
|
502
|
+
with:
|
|
503
|
+
node-version: \${{ matrix.node }}
|
|
504
|
+
cache: ${packageManager}
|
|
505
|
+
- name: 'Install dependencies'
|
|
506
|
+
run: ${packageManager} install
|
|
507
|
+
- name: Test
|
|
508
|
+
run: ${packageManager} test
|
|
509
|
+
env:
|
|
510
|
+
NAPI_RS_FORCE_WASI: true
|
|
511
|
+
|
|
521
512
|
publish:
|
|
522
513
|
name: Publish
|
|
523
514
|
runs-on: ubuntu-latest
|
|
@@ -528,6 +519,7 @@ jobs:
|
|
|
528
519
|
- test-linux-arm-gnueabihf-binding
|
|
529
520
|
- test-macOS-windows-binding
|
|
530
521
|
- test-linux-aarch64-musl-binding
|
|
522
|
+
- test-wasi-nodejs
|
|
531
523
|
- build-freebsd
|
|
532
524
|
|
|
533
525
|
steps:
|
|
@@ -536,15 +528,15 @@ jobs:
|
|
|
536
528
|
- name: Setup node
|
|
537
529
|
uses: actions/setup-node@v4
|
|
538
530
|
with:
|
|
539
|
-
node-version:
|
|
540
|
-
cache: '
|
|
531
|
+
node-version: 20
|
|
532
|
+
cache: '${packageManager}'
|
|
541
533
|
registry-url: 'https://registry.npmjs.org'
|
|
542
534
|
|
|
543
535
|
- name: 'Install dependencies'
|
|
544
|
-
run:
|
|
536
|
+
run: ${packageManager} install
|
|
545
537
|
|
|
546
538
|
- name: Download all artifacts
|
|
547
|
-
uses: actions/download-artifact@
|
|
539
|
+
uses: actions/download-artifact@v4
|
|
548
540
|
with:
|
|
549
541
|
path: artifacts
|
|
550
542
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci-template.js","sourceRoot":"","sources":["../../../src/api/templates/ci-template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ci-template.js","sourceRoot":"","sources":["../../../src/api/templates/ci-template.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,cAAuC,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAkC5C,cAAc;;qBAEd,cAAc;;;;gBAInB,cAAc;gBACd,cAAc;;;;qBAIT,cAAc;;;qBAGd,cAAc;;;qBAGd,cAAc;;;qBAGd,cAAc;;;qBAGd,cAAc;;;qBAGd,cAAc;;;qBAGd,cAAc;;;qBAGd,cAAc;;;qBAGd,cAAc;;;;;;qBAMd,cAAc;;;qBAGd,cAAc;;;;;;;;;;;;mBAYhB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAoClB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAkDK,cAAc;;;;;;;;;;;;;;;cAelC,cAAc;cACd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAmCR,cAAc;;;eAGnB,cAAc;;;;;;;;;;;;;eAad,cAAc;;;;;;;;;;;;;;;;;;;oBAmBT,cAAc;;;eAGnB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqCjB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA0Cd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA2Cd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyCd,cAAc;;;;;;;;;;;;;iBAaT,cAAc;;;;;;;;;;;;;;;mBAeZ,cAAc;;;eAGlB,cAAc;;;;;;;;;;;;;;eAcd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA8BV,cAAc;;eAElB,cAAc;;eAEd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;oBAwBT,cAAc;;;;eAInB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B5B,CAAA"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type SupportedPackageManager } from '../../utils/index.js';
|
|
2
|
+
export declare const createGithubActionsCIYml: (targets: string[], packageManager: SupportedPackageManager) => string;
|
|
@@ -8,8 +8,9 @@ const TEST_LINUX_X64_MUSL = 'test-linux-x64-musl-binding';
|
|
|
8
8
|
const TEST_LINUX_AARCH64_GNU = 'test-linux-aarch64-gnu-binding';
|
|
9
9
|
const TEST_LINUX_AARCH64_MUSL = 'test-linux-aarch64-musl-binding';
|
|
10
10
|
const TEST_LINUX_ARM_GNUEABIHF = 'test-linux-arm-gnueabihf-binding';
|
|
11
|
+
const TEST_WASI = 'test-wasi-nodejs';
|
|
11
12
|
const UNIVERSAL_MACOS = 'universal-macOS';
|
|
12
|
-
export const createGithubActionsCIYml = (targets) => {
|
|
13
|
+
export const createGithubActionsCIYml = (targets, packageManager) => {
|
|
13
14
|
const allTargets = new Set(targets.flatMap((t) => {
|
|
14
15
|
const platform = parseTriple(t);
|
|
15
16
|
if (platform.arch === 'universal') {
|
|
@@ -18,7 +19,7 @@ export const createGithubActionsCIYml = (targets) => {
|
|
|
18
19
|
}
|
|
19
20
|
return [t];
|
|
20
21
|
}));
|
|
21
|
-
const fullTemplate = load(YAML());
|
|
22
|
+
const fullTemplate = load(YAML(packageManager));
|
|
22
23
|
const requiredSteps = [];
|
|
23
24
|
const enableWindowsX86 = allTargets.has('x86_64-pc-windows-msvc');
|
|
24
25
|
const enableMacOSX86 = allTargets.has('x86_64-apple-darwin');
|
|
@@ -29,6 +30,7 @@ export const createGithubActionsCIYml = (targets) => {
|
|
|
29
30
|
const enableLinuxArm7 = allTargets.has('armv7-unknown-linux-gnueabihf');
|
|
30
31
|
const enableFreeBSD = allTargets.has('x86_64-unknown-freebsd');
|
|
31
32
|
const enableMacOSUni = allTargets.has('universal-apple-darwin');
|
|
33
|
+
const enableWasi = allTargets.has('wasm32-wasi-preview1-threads');
|
|
32
34
|
fullTemplate.jobs.build.strategy.matrix.settings =
|
|
33
35
|
fullTemplate.jobs.build.strategy.matrix.settings.filter(({ target }) => allTargets.has(target));
|
|
34
36
|
if (!fullTemplate.jobs.build.strategy.matrix.settings.length) {
|
|
@@ -91,6 +93,12 @@ export const createGithubActionsCIYml = (targets) => {
|
|
|
91
93
|
else {
|
|
92
94
|
requiredSteps.push(UNIVERSAL_MACOS);
|
|
93
95
|
}
|
|
96
|
+
if (!enableWasi) {
|
|
97
|
+
delete fullTemplate.jobs[TEST_WASI];
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
requiredSteps.push(TEST_WASI);
|
|
101
|
+
}
|
|
94
102
|
fullTemplate.jobs.publish.needs = requiredSteps;
|
|
95
103
|
return dump(fullTemplate, {
|
|
96
104
|
lineWidth: 1000,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci.yml.js","sourceRoot":"","sources":["../../../src/api/templates/ci.yml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"ci.yml.js","sourceRoot":"","sources":["../../../src/api/templates/ci.yml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEpC,OAAO,EACL,aAAa,EAEb,kBAAkB,EAClB,WAAW,GACZ,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;A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AAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,YAAY,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;IACnD,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAA;IAC7C,CAAC;IAED,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;IACpD,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAA;IAC9C,CAAC;IAED,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IAC3C,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,CAAC;SAAM,CAAC;QACN,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC/B,CAAC;IAED,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,aAAa,CAAA;IAE/C,OAAO,IAAI,CAAC,YAAY,EAAE;QACxB,SAAS,EAAE,IAAI;KAChB,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -307,6 +307,21 @@ switch (platform) {
|
|
|
307
307
|
throw new Error(\`Unsupported OS: \${platform}, architecture: \${arch}\`)
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
311
|
+
try {
|
|
312
|
+
localFileExisted = existsSync(
|
|
313
|
+
join(__dirname, '${localName}.wasm32-wasi.wasm')
|
|
314
|
+
) && existsSync(join(__dirname, '${localName}.wasi.cjs'))
|
|
315
|
+
if (localFileExisted) {
|
|
316
|
+
nativeBinding = require('./${localName}.wasi.cjs')
|
|
317
|
+
} else {
|
|
318
|
+
nativeBinding = require('${pkgName}-wasm32-wasi')
|
|
319
|
+
}
|
|
320
|
+
} catch {
|
|
321
|
+
// ignore
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
310
325
|
if (!nativeBinding) {
|
|
311
326
|
if (loadError) {
|
|
312
327
|
throw loadError
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js-binding.js","sourceRoot":"","sources":["../../../src/api/templates/js-binding.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,OAAe,EACf,MAAgB;IAEhB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAkEgD,SAAS;;;yCAGzB,SAAS;;uCAEX,OAAO;;;;;;;yDAOW,SAAS;;;yCAGzB,SAAS;;uCAEX,OAAO;;;;;;;;;;;;;;6BAcjB,SAAS;;;;yCAIG,SAAS;;uCAEX,OAAO;;;;;;;;6BAQjB,SAAS;;;;yCAIG,SAAS;;uCAEX,OAAO;;;;;;;;6BAQjB,SAAS;;;;yCAIG,SAAS;;uCAEX,OAAO;;;;;;;;;;;qDAWO,SAAS;;;qCAGzB,SAAS;;mCAEX,OAAO;;;;;;yDAMe,SAAS;;;yCAGzB,SAAS;;uCAEX,OAAO;;;;;;;;6BAQjB,SAAS;;;;yCAIG,SAAS;;uCAEX,OAAO;;;;;;;;;;;;;;qDAcO,SAAS;;;qCAGzB,SAAS;;mCAEX,OAAO;;;;;;;;;;;+BAWX,SAAS;;;;2CAIG,SAAS;;yCAEX,OAAO;;;;;;;+BAOjB,SAAS;;;;2CAIG,SAAS;;yCAEX,OAAO;;;;;;;;;;+BAUjB,SAAS;;;;2CAIG,SAAS;;yCAEX,OAAO;;;;;;;+BAOjB,SAAS;;;;2CAIG,SAAS;;yCAEX,OAAO;;;;;;;;;6BASnB,SAAS;;;;yCAIG,SAAS;;uCAE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;;;;;;;;;;yBAkBvB,SAAS;uCACK,SAAS;;mCAEb,SAAS;;iCAEX,OAAO;;;;;;;;;;;;;;EActC,MAAM;SACL,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,KAAK,oBAAoB,KAAK,EAAE,CAAC;SAClE,IAAI,CAAC,IAAI,CAAC;CACZ,CAAA;AACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-wasi-template.js","sourceRoot":"","sources":["../../../src/api/templates/load-wasi-template.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,YAAoB,EACpB,qBAA+B,EAC/B,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2KA6BsK,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;EAyBrL,qBAAqB;KACpB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,6BAA6B,IAAI,QAAQ,CAAC;KACxD,IAAI,CAAC,IAAI,CAAC;;CAEZ,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SupportedTestFramework } from '../../utils/config.js';
|
|
2
|
+
export declare const createPackageJson: ({ name, binaryName, targets, license, engineRequirement, cliVersion, testFramework, }: {
|
|
2
3
|
name: string;
|
|
3
4
|
binaryName: string;
|
|
4
5
|
targets: string[];
|
|
5
6
|
license: string;
|
|
6
7
|
engineRequirement: string;
|
|
7
8
|
cliVersion: string;
|
|
8
|
-
|
|
9
|
+
testFramework: SupportedTestFramework;
|
|
10
|
+
}) => Promise<string>;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { UNIVERSAL_TARGETS } from '../../utils/target.js';
|
|
2
|
+
export const createPackageJson = async ({ name, binaryName, targets, license, engineRequirement, cliVersion, testFramework, }) => {
|
|
3
|
+
const hasWasmTarget = targets.some((t) => t.includes('wasm'));
|
|
4
|
+
const universalTargets = targets.filter((t) => t in UNIVERSAL_TARGETS);
|
|
5
|
+
const unifiedtargets = universalTargets.length
|
|
6
|
+
? targets.filter((target) => !universalTargets.some((t) => {
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
return UNIVERSAL_TARGETS[t].includes(target);
|
|
9
|
+
}))
|
|
10
|
+
: targets;
|
|
2
11
|
const content = {
|
|
3
12
|
name,
|
|
4
|
-
version: '
|
|
13
|
+
version: '0.0.0',
|
|
5
14
|
license,
|
|
6
15
|
engines: {
|
|
7
16
|
node: engineRequirement,
|
|
@@ -13,10 +22,10 @@ export const createPackageJson = ({ name, binaryName, targets, license, engineRe
|
|
|
13
22
|
exports: undefined,
|
|
14
23
|
napi: {
|
|
15
24
|
binaryName,
|
|
16
|
-
targets,
|
|
25
|
+
targets: unifiedtargets,
|
|
17
26
|
},
|
|
18
27
|
scripts: {
|
|
19
|
-
test:
|
|
28
|
+
test: testFramework,
|
|
20
29
|
build: 'napi build --release --platform --strip',
|
|
21
30
|
'build:debug': 'napi build',
|
|
22
31
|
prepublishOnly: 'napi prepublish -t npm',
|
|
@@ -27,6 +36,21 @@ export const createPackageJson = ({ name, binaryName, targets, license, engineRe
|
|
|
27
36
|
'@napi-rs/cli': `^${cliVersion}`,
|
|
28
37
|
},
|
|
29
38
|
};
|
|
39
|
+
if (testFramework === 'ava') {
|
|
40
|
+
const avaMeta = await fetch(`https://registry.npmjs.org/ava`).then((res) => res.json());
|
|
41
|
+
content.devDependencies['ava'] = `^${avaMeta['dist-tags'].latest}`;
|
|
42
|
+
content.ava = {
|
|
43
|
+
timeout: '1m',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (hasWasmTarget) {
|
|
47
|
+
const emnapiCoreMeta = await fetch(`https://registry.npmjs.org/@emnapi/core`).then((res) => res.json());
|
|
48
|
+
const latest = emnapiCoreMeta['dist-tags'].latest;
|
|
49
|
+
content.devDependencies['@emnapi/core'] = `^${latest}`;
|
|
50
|
+
const emnapiRuntimeMeta = await fetch(`https://registry.npmjs.org/@emnapi/runtime`).then((res) => res.json());
|
|
51
|
+
const runtimeLatest = emnapiRuntimeMeta['dist-tags'].latest;
|
|
52
|
+
content.devDependencies['@emnapi/runtime'] = `^${runtimeLatest}`;
|
|
53
|
+
}
|
|
30
54
|
return JSON.stringify(content, null, 2);
|
|
31
55
|
};
|
|
32
56
|
//# sourceMappingURL=package.json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.js","sourceRoot":"","sources":["../../../src/api/templates/package.json.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.js","sourceRoot":"","sources":["../../../src/api/templates/package.json.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAMzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,IAAI,EACJ,UAAU,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,aAAa,GASd,EAAE,EAAE;IACH,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7D,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CACrC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,iBAAiB,CACQ,CAAA;IACvC,MAAM,cAAc,GAAG,gBAAgB,CAAC,MAAM;QAC5C,CAAC,CAAC,OAAO,CAAC,MAAM,CACZ,CAAC,MAAM,EAAE,EAAE,CACT,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YAC3B,mBAAmB;YACnB,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAC9C,CAAC,CAAC,CACL;QACH,CAAC,CAAC,OAAO,CAAA;IACX,MAAM,OAAO,GAA4B;QACvC,IAAI;QACJ,OAA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