ccdeck 3.49.1 → 3.51.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 +7 -3
- package/THIRD_PARTY_NOTICES.md +28 -0
- package/bin/cli/commands.js +34 -3
- package/bin/cli/second-start.js +6 -1
- package/dist/web/assets/BrowserWatchModal-CDpunrq9.js +1 -0
- package/dist/web/assets/IntegrationModal-BctMcNU8.js +7 -0
- package/dist/web/assets/{RadioPanel-gFYxdsBg.js → RadioPanel-DQNFtYOx.js} +1 -1
- package/dist/web/assets/{TrafficRadar-B9MfKca4.js → TrafficRadar-DRt3Al7E.js} +1 -1
- package/dist/web/assets/UsageHistoryModal-DlgPufgs.js +1 -0
- package/dist/web/assets/{app-D2NP6IPl.js → app-4x4wTE-L.js} +73 -73
- package/dist/web/assets/{app-DfGYllmZ.css → app-o4kL0FgZ.css} +1 -1
- package/dist/web/assets/{index-Be6Ox-74.js → index-CWUj8Kqh.js} +1 -1
- package/dist/web/index.html +3 -3
- package/node_modules/bare-addon-resolve/LICENSE +201 -0
- package/node_modules/bare-addon-resolve/README.md +226 -0
- package/node_modules/bare-addon-resolve/index.d.ts +100 -0
- package/node_modules/bare-addon-resolve/index.js +531 -0
- package/node_modules/bare-addon-resolve/lib/errors.d.ts +16 -0
- package/node_modules/bare-addon-resolve/lib/errors.js +21 -0
- package/node_modules/bare-addon-resolve/package.json +57 -0
- package/node_modules/bare-module-resolve/LICENSE +201 -0
- package/node_modules/bare-module-resolve/README.md +322 -0
- package/node_modules/bare-module-resolve/index.d.ts +171 -0
- package/node_modules/bare-module-resolve/index.js +899 -0
- package/node_modules/bare-module-resolve/lib/errors.d.ts +31 -0
- package/node_modules/bare-module-resolve/lib/errors.js +37 -0
- package/node_modules/bare-module-resolve/package.json +56 -0
- package/node_modules/bare-semver/LICENSE +201 -0
- package/node_modules/bare-semver/README.md +147 -0
- package/node_modules/bare-semver/index.d.ts +61 -0
- package/node_modules/bare-semver/index.js +13 -0
- package/node_modules/bare-semver/lib/comparator.js +37 -0
- package/node_modules/bare-semver/lib/constants.js +7 -0
- package/node_modules/bare-semver/lib/errors.js +22 -0
- package/node_modules/bare-semver/lib/range.js +256 -0
- package/node_modules/bare-semver/lib/version.js +240 -0
- package/node_modules/bare-semver/package.json +43 -0
- package/node_modules/fs-native-extensions/CMakeLists.txt +118 -0
- package/node_modules/fs-native-extensions/LICENSE +201 -0
- package/node_modules/fs-native-extensions/README.md +160 -0
- package/node_modules/fs-native-extensions/binding.c +1825 -0
- package/node_modules/fs-native-extensions/binding.js +3 -0
- package/node_modules/fs-native-extensions/include/fs-ext.h +193 -0
- package/node_modules/fs-native-extensions/index.js +356 -0
- package/node_modules/fs-native-extensions/package.json +72 -0
- package/node_modules/fs-native-extensions/prebuilds/android-arm/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-arm/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-arm64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-ia32/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-ia32/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-x64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/android-x64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/darwin-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/darwin-arm64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/darwin-x64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/darwin-x64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/ios-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/ios-arm64-simulator/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/ios-x64-simulator/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/linux-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/linux-arm64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/linux-x64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/linux-x64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/win32-arm64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/win32-arm64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/prebuilds/win32-x64/fs-native-extensions.bare +0 -0
- package/node_modules/fs-native-extensions/prebuilds/win32-x64/fs-native-extensions.node +0 -0
- package/node_modules/fs-native-extensions/src/apple.c +197 -0
- package/node_modules/fs-native-extensions/src/linux.c +146 -0
- package/node_modules/fs-native-extensions/src/platform.h +51 -0
- package/node_modules/fs-native-extensions/src/posix.c +33 -0
- package/node_modules/fs-native-extensions/src/shared.c +397 -0
- package/node_modules/fs-native-extensions/src/win32/nt.h +226 -0
- package/node_modules/fs-native-extensions/src/win32.c +531 -0
- package/node_modules/require-addon/LICENSE +201 -0
- package/node_modules/require-addon/README.md +19 -0
- package/node_modules/require-addon/lib/bare.js +1 -0
- package/node_modules/require-addon/lib/default.js +7 -0
- package/node_modules/require-addon/lib/node.js +79 -0
- package/node_modules/require-addon/package.json +64 -0
- package/node_modules/which-runtime/LICENSE +201 -0
- package/node_modules/which-runtime/README.md +29 -0
- package/node_modules/which-runtime/index.js +36 -0
- package/node_modules/which-runtime/package.json +32 -0
- package/package.json +12 -2
- package/release-notes.json +25 -0
- package/src/server/claude-accounts.mjs +19 -3
- package/src/server/claude-collector.mjs +18 -2
- package/src/server/cswap-install.mjs +60 -18
- package/src/server/integrations/jira-comment.mjs +37 -0
- package/src/server/integrations/jira-move.mjs +37 -11
- package/src/server/integrations/jira-transition.mjs +43 -0
- package/src/server/integrations/jira-write-guard.mjs +218 -0
- package/src/server/integrations/jira.mjs +16 -0
- package/src/server/integrations/routes.mjs +70 -7
- package/src/server/lan-deck.mjs +9 -0
- package/src/server/lan-engine.mjs +17 -2
- package/src/server/lan-manifest.mjs +10 -3
- package/src/server/lifecycle.mjs +27 -2
- package/src/server/login-guard.mjs +4 -0
- package/src/server/npm-upgrade.mjs +46 -18
- package/src/server/pinned-build.mjs +5 -0
- package/src/server/quota-store-resets.mjs +13 -6
- package/src/server/quota.mjs +8 -1
- package/src/server/running-deck.mjs +14 -0
- package/src/server/static-cache.mjs +34 -16
- package/src/server/terminal-cli-update.mjs +189 -0
- package/src/server/terminal-cli.mjs +93 -0
- package/src/server/traffic-radar-wire.mjs +6 -0
- package/src/server/usage-share.mjs +444 -0
- package/dist/web/assets/BrowserWatchModal-CCARqAMn.js +0 -1
- package/dist/web/assets/IntegrationModal-B8t53aE5.js +0 -7
- package/dist/web/assets/UsageHistoryModal-DvYWhsYv.js +0 -1
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
const resolve = require('bare-module-resolve')
|
|
2
|
+
const { Version } = require('bare-semver')
|
|
3
|
+
const errors = require('./lib/errors')
|
|
4
|
+
|
|
5
|
+
module.exports = exports = function resolve(specifier, parentURL, opts, readPackage) {
|
|
6
|
+
if (typeof opts === 'function') {
|
|
7
|
+
readPackage = opts
|
|
8
|
+
opts = {}
|
|
9
|
+
} else if (typeof readPackage !== 'function') {
|
|
10
|
+
readPackage = defaultReadPackage
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
*[Symbol.iterator]() {
|
|
15
|
+
const generator = exports.addon(specifier, parentURL, opts)
|
|
16
|
+
|
|
17
|
+
let next = generator.next()
|
|
18
|
+
|
|
19
|
+
while (next.done !== true) {
|
|
20
|
+
const value = next.value
|
|
21
|
+
|
|
22
|
+
if (value.package) {
|
|
23
|
+
next = generator.next(readPackage(value.package))
|
|
24
|
+
} else {
|
|
25
|
+
next = generator.next(yield value.resolution)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return next.value
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
async *[Symbol.asyncIterator]() {
|
|
33
|
+
const generator = exports.addon(specifier, parentURL, opts)
|
|
34
|
+
|
|
35
|
+
let next = generator.next()
|
|
36
|
+
|
|
37
|
+
while (next.done !== true) {
|
|
38
|
+
const value = next.value
|
|
39
|
+
|
|
40
|
+
if (value.package) {
|
|
41
|
+
next = generator.next(await readPackage(value.package))
|
|
42
|
+
} else {
|
|
43
|
+
next = generator.next(yield value.resolution)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return next.value
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function defaultReadPackage() {
|
|
53
|
+
return null
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const { UNRESOLVED, YIELDED, RESOLVED } = resolve.constants
|
|
57
|
+
|
|
58
|
+
exports.constants = {
|
|
59
|
+
UNRESOLVED,
|
|
60
|
+
YIELDED,
|
|
61
|
+
RESOLVED
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
exports.addon = function* (specifier, parentURL, opts = {}) {
|
|
65
|
+
const { resolutions = null } = opts
|
|
66
|
+
|
|
67
|
+
if (exports.startsWithWindowsDriveLetter(specifier)) {
|
|
68
|
+
specifier = '/' + specifier
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let status
|
|
72
|
+
|
|
73
|
+
if (resolutions) {
|
|
74
|
+
status = yield* preresolved(specifier, resolutions, parentURL, opts)
|
|
75
|
+
|
|
76
|
+
if (status) return status
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
status = yield* exports.url(specifier, parentURL, opts)
|
|
80
|
+
|
|
81
|
+
if (status) return status
|
|
82
|
+
|
|
83
|
+
let version = null
|
|
84
|
+
|
|
85
|
+
const i = specifier.lastIndexOf('@')
|
|
86
|
+
|
|
87
|
+
if (i > 0) {
|
|
88
|
+
version = specifier.substring(i + 1)
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
Version.parse(version)
|
|
92
|
+
|
|
93
|
+
specifier = specifier.substring(0, i)
|
|
94
|
+
} catch {
|
|
95
|
+
version = null
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (
|
|
100
|
+
specifier === '.' ||
|
|
101
|
+
specifier === '..' ||
|
|
102
|
+
specifier[0] === '/' ||
|
|
103
|
+
specifier[0] === '\\' ||
|
|
104
|
+
specifier.startsWith('./') ||
|
|
105
|
+
specifier.startsWith('.\\') ||
|
|
106
|
+
specifier.startsWith('../') ||
|
|
107
|
+
specifier.startsWith('..\\')
|
|
108
|
+
) {
|
|
109
|
+
status = yield* exports.file(specifier, parentURL, opts)
|
|
110
|
+
|
|
111
|
+
if (status === RESOLVED) return status
|
|
112
|
+
|
|
113
|
+
return yield* exports.directory(specifier, version, parentURL, opts)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return yield* exports.package(specifier, version, parentURL, opts)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function* preresolved(specifier, resolutions, parentURL, opts) {
|
|
120
|
+
const { deferredProtocol = 'deferred:' } = opts
|
|
121
|
+
|
|
122
|
+
const generator = resolve.preresolved(specifier, resolutions, parentURL, {
|
|
123
|
+
...opts,
|
|
124
|
+
deferredProtocol: null
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
let next = generator.next()
|
|
128
|
+
|
|
129
|
+
while (next.done !== true) {
|
|
130
|
+
const value = next.value
|
|
131
|
+
|
|
132
|
+
if (value.resolution && value.resolution.protocol === deferredProtocol) return UNRESOLVED
|
|
133
|
+
|
|
134
|
+
next = generator.next(yield value)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return next.value
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
exports.url = function* (url, parentURL, opts = {}) {
|
|
141
|
+
let resolution
|
|
142
|
+
try {
|
|
143
|
+
resolution = new URL(url)
|
|
144
|
+
} catch {
|
|
145
|
+
return UNRESOLVED
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const resolved = yield { resolution }
|
|
149
|
+
|
|
150
|
+
return resolved ? RESOLVED : YIELDED
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
exports.package = function* (packageSpecifier, packageVersion, parentURL, opts = {}) {
|
|
154
|
+
if (packageSpecifier === '') {
|
|
155
|
+
throw errors.INVALID_ADDON_SPECIFIER(
|
|
156
|
+
`Addon specifier '${packageSpecifier}' is not a valid package name`
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
let packageName
|
|
161
|
+
|
|
162
|
+
if (packageSpecifier[0] !== '@') {
|
|
163
|
+
packageName = packageSpecifier.split('/', 1).join()
|
|
164
|
+
} else {
|
|
165
|
+
if (!packageSpecifier.includes('/')) {
|
|
166
|
+
throw errors.INVALID_ADDON_SPECIFIER(
|
|
167
|
+
`Addon specifier '${packageSpecifier}' is not a valid package name`
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
packageName = packageSpecifier.split('/', 2).join('/')
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (packageName[0] === '.' || packageName.includes('\\') || packageName.includes('%')) {
|
|
175
|
+
throw errors.INVALID_ADDON_SPECIFIER(
|
|
176
|
+
`Addon specifier '${packageSpecifier}' is not a valid package name`
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const packageSubpath = '.' + packageSpecifier.substring(packageName.length)
|
|
181
|
+
|
|
182
|
+
if (hasOpaquePath(parentURL)) return UNRESOLVED
|
|
183
|
+
|
|
184
|
+
const status = yield* exports.packageSelf(
|
|
185
|
+
packageName,
|
|
186
|
+
packageSubpath,
|
|
187
|
+
packageVersion,
|
|
188
|
+
parentURL,
|
|
189
|
+
opts
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
if (status) return status
|
|
193
|
+
|
|
194
|
+
parentURL = new URL(parentURL.href)
|
|
195
|
+
|
|
196
|
+
do {
|
|
197
|
+
const packageURL = new URL('node_modules/' + packageName + '/', parentURL)
|
|
198
|
+
|
|
199
|
+
parentURL.pathname = parentURL.pathname.substring(0, parentURL.pathname.lastIndexOf('/'))
|
|
200
|
+
|
|
201
|
+
const info = yield { package: new URL('package.json', packageURL) }
|
|
202
|
+
|
|
203
|
+
if (info) {
|
|
204
|
+
return yield* exports.directory(packageSubpath, packageVersion, packageURL, opts)
|
|
205
|
+
}
|
|
206
|
+
} while (parentURL.pathname !== '' && parentURL.pathname !== '/')
|
|
207
|
+
|
|
208
|
+
return UNRESOLVED
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
exports.packageSelf = function* (
|
|
212
|
+
packageName,
|
|
213
|
+
packageSubpath,
|
|
214
|
+
packageVersion,
|
|
215
|
+
parentURL,
|
|
216
|
+
opts = {}
|
|
217
|
+
) {
|
|
218
|
+
for (const packageURL of resolve.lookupPackageScope(parentURL, opts)) {
|
|
219
|
+
const info = yield { package: packageURL }
|
|
220
|
+
|
|
221
|
+
if (info) {
|
|
222
|
+
if (info.name === packageName) {
|
|
223
|
+
return yield* exports.directory(packageSubpath, packageVersion, packageURL, opts)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
break
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return UNRESOLVED
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
exports.lookupPrebuildsScope = function* lookupPrebuildsScope(url, opts = {}) {
|
|
234
|
+
if (hasOpaquePath(url)) return
|
|
235
|
+
|
|
236
|
+
const scopeURL = new URL(url.href)
|
|
237
|
+
|
|
238
|
+
do {
|
|
239
|
+
yield new URL('prebuilds/', scopeURL)
|
|
240
|
+
|
|
241
|
+
scopeURL.pathname = scopeURL.pathname.substring(0, scopeURL.pathname.lastIndexOf('/'))
|
|
242
|
+
|
|
243
|
+
if (
|
|
244
|
+
scopeURL.pathname.length === 3 &&
|
|
245
|
+
exports.isWindowsDriveLetter(scopeURL.pathname.substring(1))
|
|
246
|
+
) {
|
|
247
|
+
break
|
|
248
|
+
}
|
|
249
|
+
} while (scopeURL.pathname !== '' && scopeURL.pathname !== '/')
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
exports.file = function* (filename, parentURL, opts = {}) {
|
|
253
|
+
if (
|
|
254
|
+
filename === '.' ||
|
|
255
|
+
filename === '..' ||
|
|
256
|
+
filename[filename.length - 1] === '/' ||
|
|
257
|
+
filename[filename.length - 1] === '\\'
|
|
258
|
+
) {
|
|
259
|
+
return UNRESOLVED
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (hasOpaquePath(parentURL)) return UNRESOLVED
|
|
263
|
+
|
|
264
|
+
if (parentURL.protocol === 'file:' && /%2f|%5c/i.test(filename)) {
|
|
265
|
+
throw errors.INVALID_ADDON_SPECIFIER(`Addon specifier '${filename}' is invalid`)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const { extensions = [] } = opts
|
|
269
|
+
|
|
270
|
+
let status = UNRESOLVED
|
|
271
|
+
|
|
272
|
+
for (let ext of extensions) {
|
|
273
|
+
if (filename.endsWith(ext)) ext = ''
|
|
274
|
+
|
|
275
|
+
if (yield { resolution: new URL(filename + ext, parentURL) }) {
|
|
276
|
+
return RESOLVED
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
status = YIELDED
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return status
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
exports.directory = function* (dirname, version, parentURL, opts = {}) {
|
|
286
|
+
const {
|
|
287
|
+
host = null, // Shorthand for single host resolution
|
|
288
|
+
hosts = host !== null ? [host] : [],
|
|
289
|
+
builtins = []
|
|
290
|
+
} = opts
|
|
291
|
+
|
|
292
|
+
if (hasOpaquePath(parentURL)) return UNRESOLVED
|
|
293
|
+
|
|
294
|
+
let directoryURL
|
|
295
|
+
|
|
296
|
+
if (dirname[dirname.length - 1] === '/' || dirname[dirname.length - 1] === '\\') {
|
|
297
|
+
directoryURL = new URL(dirname, parentURL)
|
|
298
|
+
} else {
|
|
299
|
+
directoryURL = new URL(dirname + '/', parentURL)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const unversioned = version === null
|
|
303
|
+
|
|
304
|
+
let name = null
|
|
305
|
+
|
|
306
|
+
const info = yield { package: new URL('package.json', directoryURL) }
|
|
307
|
+
|
|
308
|
+
if (info) {
|
|
309
|
+
if (typeof info.name === 'string' && info.name !== '') {
|
|
310
|
+
if (info.name.includes('__')) {
|
|
311
|
+
throw errors.INVALID_PACKAGE_NAME(`Package name '${info.name}' is invalid`)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
name = info.name.replace(/\//g, '__').replace(/^@/, '')
|
|
315
|
+
} else {
|
|
316
|
+
return UNRESOLVED
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (typeof info.version === 'string' && info.version !== '') {
|
|
320
|
+
if (version !== null && info.version !== version) return UNRESOLVED
|
|
321
|
+
|
|
322
|
+
version = info.version
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
return UNRESOLVED
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
let status
|
|
329
|
+
|
|
330
|
+
status = yield* resolve.builtinTarget(name, version, builtins, opts)
|
|
331
|
+
|
|
332
|
+
if (status) return status
|
|
333
|
+
|
|
334
|
+
const native = hosts.filter((host) => !isWebAssemblyHost(host))
|
|
335
|
+
|
|
336
|
+
status = yield* prebuilds(name, version, unversioned, directoryURL, native, opts)
|
|
337
|
+
|
|
338
|
+
if (status === RESOLVED) return status
|
|
339
|
+
|
|
340
|
+
status = yield* exports.linked(name, version, opts)
|
|
341
|
+
|
|
342
|
+
if (status === RESOLVED) return status
|
|
343
|
+
|
|
344
|
+
const wasm = hosts.filter(isWebAssemblyHost)
|
|
345
|
+
|
|
346
|
+
return yield* prebuilds(name, version, unversioned, directoryURL, wasm, {
|
|
347
|
+
...opts,
|
|
348
|
+
extensions: ['.wasm']
|
|
349
|
+
})
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function* prebuilds(name, version, unversioned, directoryURL, hosts, opts) {
|
|
353
|
+
const { matchedConditions = [] } = opts
|
|
354
|
+
|
|
355
|
+
let status = UNRESOLVED
|
|
356
|
+
|
|
357
|
+
for (const prebuildsURL of exports.lookupPrebuildsScope(directoryURL, opts)) {
|
|
358
|
+
status = UNRESOLVED
|
|
359
|
+
|
|
360
|
+
for (const host of hosts) {
|
|
361
|
+
const conditions = host.split('-')
|
|
362
|
+
|
|
363
|
+
const universal = supportsUniversalPrebuilds(host)
|
|
364
|
+
? conditions.with(1, 'universal').join('-')
|
|
365
|
+
: null
|
|
366
|
+
|
|
367
|
+
matchedConditions.push(...conditions)
|
|
368
|
+
|
|
369
|
+
if (version !== null) {
|
|
370
|
+
status |= yield* exports.file(host + '/' + name + '@' + version, prebuildsURL, opts)
|
|
371
|
+
|
|
372
|
+
if (universal) {
|
|
373
|
+
status |= yield* exports.file(universal + '/' + name + '@' + version, prebuildsURL, opts)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (unversioned) {
|
|
378
|
+
status |= yield* exports.file(host + '/' + name, prebuildsURL, opts)
|
|
379
|
+
|
|
380
|
+
if (universal) {
|
|
381
|
+
status |= yield* exports.file(universal + '/' + name, prebuildsURL, opts)
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
for (const _ of conditions) matchedConditions.pop()
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (status === RESOLVED) return status
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
return status
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
exports.linked = function* (name, version = null, opts = {}) {
|
|
395
|
+
const {
|
|
396
|
+
linked = true,
|
|
397
|
+
host = null, // Shorthand for single host resolution
|
|
398
|
+
hosts = host !== null ? [host] : [],
|
|
399
|
+
matchedConditions = []
|
|
400
|
+
} = opts
|
|
401
|
+
|
|
402
|
+
if (linked === false || hosts.length === 0) return UNRESOLVED
|
|
403
|
+
|
|
404
|
+
let status = UNRESOLVED
|
|
405
|
+
|
|
406
|
+
for (const host of hosts) {
|
|
407
|
+
const [platform = null] = host.split('-', 1)
|
|
408
|
+
|
|
409
|
+
if (platform === null) continue
|
|
410
|
+
|
|
411
|
+
matchedConditions.push(platform)
|
|
412
|
+
|
|
413
|
+
status |= yield* platformArtefact(name, version, platform, opts)
|
|
414
|
+
|
|
415
|
+
matchedConditions.pop()
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
return status
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function* platformArtefact(name, version = null, platform, opts = {}) {
|
|
422
|
+
const { linkedProtocol = 'linked:' } = opts
|
|
423
|
+
|
|
424
|
+
if (platform === 'darwin' || platform === 'ios') {
|
|
425
|
+
if (version !== null) {
|
|
426
|
+
if (
|
|
427
|
+
yield {
|
|
428
|
+
resolution: new URL(`${linkedProtocol}${name}.${version}.framework/${name}.${version}`)
|
|
429
|
+
}
|
|
430
|
+
) {
|
|
431
|
+
return RESOLVED
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
if (platform === 'darwin') {
|
|
435
|
+
if (
|
|
436
|
+
yield {
|
|
437
|
+
resolution: new URL(`${linkedProtocol}lib${name}.${version}.dylib`)
|
|
438
|
+
}
|
|
439
|
+
) {
|
|
440
|
+
return RESOLVED
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
if (
|
|
446
|
+
yield {
|
|
447
|
+
resolution: new URL(`${linkedProtocol}${name}.framework/${name}`)
|
|
448
|
+
}
|
|
449
|
+
) {
|
|
450
|
+
return RESOLVED
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
if (platform === 'darwin') {
|
|
454
|
+
if (
|
|
455
|
+
yield {
|
|
456
|
+
resolution: new URL(`${linkedProtocol}lib${name}.dylib`)
|
|
457
|
+
}
|
|
458
|
+
) {
|
|
459
|
+
return RESOLVED
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return YIELDED
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (platform === 'linux' || platform === 'android') {
|
|
467
|
+
if (version !== null) {
|
|
468
|
+
if (
|
|
469
|
+
yield {
|
|
470
|
+
resolution: new URL(`${linkedProtocol}lib${name}.${version}.so`)
|
|
471
|
+
}
|
|
472
|
+
) {
|
|
473
|
+
return RESOLVED
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (
|
|
478
|
+
yield {
|
|
479
|
+
resolution: new URL(`${linkedProtocol}lib${name}.so`)
|
|
480
|
+
}
|
|
481
|
+
) {
|
|
482
|
+
return RESOLVED
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return YIELDED
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (platform === 'win32') {
|
|
489
|
+
if (version !== null) {
|
|
490
|
+
if (
|
|
491
|
+
yield {
|
|
492
|
+
resolution: new URL(`${linkedProtocol}${name}-${version}.dll`)
|
|
493
|
+
}
|
|
494
|
+
) {
|
|
495
|
+
return RESOLVED
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (
|
|
500
|
+
yield {
|
|
501
|
+
resolution: new URL(`${linkedProtocol}${name}.dll`)
|
|
502
|
+
}
|
|
503
|
+
) {
|
|
504
|
+
return RESOLVED
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
return UNRESOLVED
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
exports.isWindowsDriveLetter = resolve.isWindowsDriveLetter
|
|
512
|
+
|
|
513
|
+
exports.startsWithWindowsDriveLetter = resolve.startsWithWindowsDriveLetter
|
|
514
|
+
|
|
515
|
+
function isWebAssemblyHost(host) {
|
|
516
|
+
return host.startsWith('wasi-')
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function supportsUniversalPrebuilds(host) {
|
|
520
|
+
return (
|
|
521
|
+
host === 'darwin-arm64' ||
|
|
522
|
+
host === 'darwin-x64' ||
|
|
523
|
+
host === 'ios-arm64-simulator' ||
|
|
524
|
+
host === 'ios-x64-simulator'
|
|
525
|
+
)
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// https://url.spec.whatwg.org/#url-opaque-path
|
|
529
|
+
function hasOpaquePath(url) {
|
|
530
|
+
return url.pathname[0] !== '/'
|
|
531
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare class AddonResolveError extends Error {
|
|
2
|
+
readonly code: string
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param msg - The error message.
|
|
6
|
+
* @returns A new `AddonResolveError` with code `INVALID_ADDON_SPECIFIER`.
|
|
7
|
+
*/
|
|
8
|
+
static INVALID_ADDON_SPECIFIER(msg: string): AddonResolveError
|
|
9
|
+
/**
|
|
10
|
+
* @param msg - The error message.
|
|
11
|
+
* @returns A new `AddonResolveError` with code `INVALID_PACKAGE_NAME`.
|
|
12
|
+
*/
|
|
13
|
+
static INVALID_PACKAGE_NAME(msg: string): AddonResolveError
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export = AddonResolveError
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = class AddonResolveError extends Error {
|
|
2
|
+
constructor(msg, fn = AddonResolveError, code = fn.name) {
|
|
3
|
+
super(`${code}: ${msg}`)
|
|
4
|
+
|
|
5
|
+
this.code = code
|
|
6
|
+
|
|
7
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, fn)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get name() {
|
|
11
|
+
return 'AddonResolveError'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static INVALID_ADDON_SPECIFIER(msg) {
|
|
15
|
+
return new AddonResolveError(msg, AddonResolveError.INVALID_ADDON_SPECIFIER)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static INVALID_PACKAGE_NAME(msg) {
|
|
19
|
+
return new AddonResolveError(msg, AddonResolveError.INVALID_PACKAGE_NAME)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bare-addon-resolve",
|
|
3
|
+
"version": "1.11.0",
|
|
4
|
+
"description": "Low-level addon resolution algorithm for Bare",
|
|
5
|
+
"exports": {
|
|
6
|
+
"./package": "./package.json",
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"default": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"./errors": {
|
|
12
|
+
"types": "./lib/errors.d.ts",
|
|
13
|
+
"default": "./lib/errors.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"index.js",
|
|
18
|
+
"index.d.ts",
|
|
19
|
+
"lib"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"format": "prettier --write . && lunte --fix",
|
|
23
|
+
"lint": "prettier --check . && lunte",
|
|
24
|
+
"test": "npm run test:bare && npm run test:node",
|
|
25
|
+
"test:bare": "brittle-bare --coverage test.js",
|
|
26
|
+
"test:node": "brittle-node --coverage test.js"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git+https://github.com/holepunchto/bare-addon-resolve.git"
|
|
31
|
+
},
|
|
32
|
+
"author": "Holepunch",
|
|
33
|
+
"license": "Apache-2.0",
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/holepunchto/bare-addon-resolve/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/holepunchto/bare-addon-resolve#readme",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"bare-module-resolve": "^1.10.0",
|
|
40
|
+
"bare-semver": "^1.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"bare-url": "^2.1.3",
|
|
44
|
+
"brittle": "^3.2.1",
|
|
45
|
+
"lunte": "^1.8.4",
|
|
46
|
+
"prettier": "^3.3.3",
|
|
47
|
+
"prettier-config-holepunch": "^2.0.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"bare-url": "*"
|
|
51
|
+
},
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"bare-url": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|