vxrn 2.6.8 → 2.6.10
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/utils/nativeSourceContract.mjs +15 -5
- package/dist/utils/nativeSourceContract.mjs.map +1 -1
- package/dist/utils/nativeSourceContract.native.js +15 -15
- package/dist/utils/nativeSourceContract.native.js.map +1 -1
- package/dist/utils/swiftPackageId.mjs +3 -1
- package/dist/utils/swiftPackageId.mjs.map +1 -1
- package/dist/utils/swiftPackageId.native.js +7 -3
- package/dist/utils/swiftPackageId.native.js.map +1 -1
- package/package.json +11 -11
- package/src/exports/prebuildWithoutExpo.test.ts +24 -0
- package/src/utils/nativeSourceContract.test.ts +11 -0
- package/src/utils/nativeSourceContract.ts +18 -5
- package/src/utils/swiftPackageId.ts +7 -2
- package/types/utils/nativeSourceContract.d.ts.map +1 -1
- package/types/utils/swiftPackageId.d.ts.map +1 -1
|
@@ -21,7 +21,8 @@ function swiftPackageDirectories(root) {
|
|
|
21
21
|
const packages = /* @__PURE__ */ new Map();
|
|
22
22
|
const walk = (dir) => {
|
|
23
23
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
24
|
-
|
|
24
|
+
const has = (name) => entries.some((entry) => entry.isFile() && entry.name === name);
|
|
25
|
+
if (has("Package.swift")) {
|
|
25
26
|
const name = swiftPackageId(dir);
|
|
26
27
|
const previous = packages.get(name);
|
|
27
28
|
if (previous) {
|
|
@@ -30,6 +31,7 @@ function swiftPackageDirectories(root) {
|
|
|
30
31
|
packages.set(name, dir);
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
34
|
+
if (dir !== root && has("package.json")) return;
|
|
33
35
|
for (const entry of entries) {
|
|
34
36
|
if (!entry.isDirectory() || entry.name.startsWith(".") || skip.has(entry.name)) continue;
|
|
35
37
|
walk(join(dir, entry.name));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swiftPackageId.js","names":[],"sources":["utils/swiftPackageId.js"],"sourcesContent":["import { existsSync, readdirSync } from \"node:fs\";\nimport { basename, dirname, join } from \"node:path\";\nfunction swiftPackageId(packageDir) {\n return basename(packageDir).replace(/[^A-Za-z0-9_]/g, \"_\").replace(/^(\\d)/, \"_$1\");\n}\nfunction swiftPackageDirOf(file) {\n for (let dir = dirname(file); dirname(dir) !== dir; dir = dirname(dir)) {\n if (existsSync(join(dir, \"Package.swift\"))) return dir;\n }\n}\nfunction swiftPackageDirectories(root) {\n const skip = /* @__PURE__ */ new Set([\"node_modules\", \"ios\", \"android\", \"dist\", \"types\", \"build\"]);\n const packages = /* @__PURE__ */ new Map();\n const walk = (dir) => {\n const entries = readdirSync(dir, { withFileTypes: true });\n
|
|
1
|
+
{"version":3,"file":"swiftPackageId.js","names":[],"sources":["utils/swiftPackageId.js"],"sourcesContent":["import { existsSync, readdirSync } from \"node:fs\";\nimport { basename, dirname, join } from \"node:path\";\nfunction swiftPackageId(packageDir) {\n return basename(packageDir).replace(/[^A-Za-z0-9_]/g, \"_\").replace(/^(\\d)/, \"_$1\");\n}\nfunction swiftPackageDirOf(file) {\n for (let dir = dirname(file); dirname(dir) !== dir; dir = dirname(dir)) {\n if (existsSync(join(dir, \"Package.swift\"))) return dir;\n }\n}\nfunction swiftPackageDirectories(root) {\n const skip = /* @__PURE__ */ new Set([\"node_modules\", \"ios\", \"android\", \"dist\", \"types\", \"build\"]);\n const packages = /* @__PURE__ */ new Map();\n const walk = (dir) => {\n const entries = readdirSync(dir, { withFileTypes: true });\n const has = (name) => entries.some((entry) => entry.isFile() && entry.name === name);\n if (has(\"Package.swift\")) {\n const name = swiftPackageId(dir);\n const previous = packages.get(name);\n if (previous) {\n throw new Error(`[vxrn] swift packages ${previous} and ${dir} both have name ${name}`);\n }\n packages.set(name, dir);\n return;\n }\n if (dir !== root && has(\"package.json\")) return;\n for (const entry of entries) {\n if (!entry.isDirectory() || entry.name.startsWith(\".\") || skip.has(entry.name)) continue;\n walk(join(dir, entry.name));\n }\n };\n walk(root);\n return packages;\n}\nexport {\n swiftPackageDirOf,\n swiftPackageDirectories,\n swiftPackageId\n};\n//# sourceMappingURL=swiftPackageId.js.map\n"],"mappings":";;;;AAEA,SAAS,eAAe,YAAY;CAClC,OAAO,SAAS,UAAU,CAAC,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC,QAAQ,SAAS,KAAK;AACnF;AACA,SAAS,kBAAkB,MAAM;CAC/B,KAAK,IAAI,MAAM,QAAQ,IAAI,GAAG,QAAQ,GAAG,MAAM,KAAK,MAAM,QAAQ,GAAG,GAAG;EACtE,IAAI,WAAW,KAAK,KAAK,eAAe,CAAC,GAAG,OAAO;CACrD;AACF;AACA,SAAS,wBAAwB,MAAM;CACrC,MAAM,uBAAuB,IAAI,IAAI;EAAC;EAAgB;EAAO;EAAW;EAAQ;EAAS;CAAO,CAAC;CACjG,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,QAAQ,QAAQ;EACpB,MAAM,UAAU,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC;EACxD,MAAM,OAAO,SAAS,QAAQ,MAAM,UAAU,MAAM,OAAO,KAAK,MAAM,SAAS,IAAI;EACnF,IAAI,IAAI,eAAe,GAAG;GACxB,MAAM,OAAO,eAAe,GAAG;GAC/B,MAAM,WAAW,SAAS,IAAI,IAAI;GAClC,IAAI,UAAU;IACZ,MAAM,IAAI,MAAM,yBAAyB,SAAS,OAAO,IAAI,kBAAkB,MAAM;GACvF;GACA,SAAS,IAAI,MAAM,GAAG;GACtB;EACF;EACA,IAAI,QAAQ,QAAQ,IAAI,cAAc,GAAG;EACzC,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,CAAC,MAAM,YAAY,KAAK,MAAM,KAAK,WAAW,GAAG,KAAK,KAAK,IAAI,MAAM,IAAI,GAAG;GAChF,KAAK,KAAK,KAAK,MAAM,IAAI,CAAC;EAC5B;CACF;CACA,KAAK,IAAI;CACT,OAAO;AACT"}
|
|
@@ -21,9 +21,12 @@ function swiftPackageDirectories(root) {
|
|
|
21
21
|
var packages = /* @__PURE__ */ new Map();
|
|
22
22
|
var walk = function walk1(dir) {
|
|
23
23
|
var entries = readdirSync(dir, { withFileTypes: true });
|
|
24
|
-
|
|
25
|
-
return
|
|
26
|
-
|
|
24
|
+
var has = function has2(name2) {
|
|
25
|
+
return entries.some(function(entry2) {
|
|
26
|
+
return entry2.isFile() && entry2.name === name2;
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
if (has("Package.swift")) {
|
|
27
30
|
var name = swiftPackageId(dir);
|
|
28
31
|
var previous = packages.get(name);
|
|
29
32
|
if (previous) {
|
|
@@ -32,6 +35,7 @@ function swiftPackageDirectories(root) {
|
|
|
32
35
|
packages.set(name, dir);
|
|
33
36
|
return;
|
|
34
37
|
}
|
|
38
|
+
if (dir !== root && has("package.json")) return;
|
|
35
39
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
36
40
|
try {
|
|
37
41
|
for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swiftPackageId.native.js","names":[],"sources":["utils/swiftPackageId.native.js"],"sourcesContent":["import { existsSync, readdirSync } from \"fs\";\nimport { basename, dirname, join } from \"path\";\nfunction swiftPackageId(packageDir) {\n return basename(packageDir).replace(/[^A-Za-z0-9_]/g, \"_\").replace(/^(\\d)/, \"_$1\");\n}\nfunction swiftPackageDirOf(file) {\n for (var dir = dirname(file); dirname(dir) !== dir; dir = dirname(dir)) {\n if (existsSync(join(dir, \"Package.swift\"))) return dir;\n }\n}\nfunction swiftPackageDirectories(root) {\n var skip = /* @__PURE__ */ new Set([\n \"node_modules\",\n \"ios\",\n \"android\",\n \"dist\",\n \"types\",\n \"build\"\n ]);\n var packages = /* @__PURE__ */ new Map();\n var walk = function walk1(dir) {\n var entries = readdirSync(dir, {\n withFileTypes: true\n });\n
|
|
1
|
+
{"version":3,"file":"swiftPackageId.native.js","names":[],"sources":["utils/swiftPackageId.native.js"],"sourcesContent":["import { existsSync, readdirSync } from \"fs\";\nimport { basename, dirname, join } from \"path\";\nfunction swiftPackageId(packageDir) {\n return basename(packageDir).replace(/[^A-Za-z0-9_]/g, \"_\").replace(/^(\\d)/, \"_$1\");\n}\nfunction swiftPackageDirOf(file) {\n for (var dir = dirname(file); dirname(dir) !== dir; dir = dirname(dir)) {\n if (existsSync(join(dir, \"Package.swift\"))) return dir;\n }\n}\nfunction swiftPackageDirectories(root) {\n var skip = /* @__PURE__ */ new Set([\n \"node_modules\",\n \"ios\",\n \"android\",\n \"dist\",\n \"types\",\n \"build\"\n ]);\n var packages = /* @__PURE__ */ new Map();\n var walk = function walk1(dir) {\n var entries = readdirSync(dir, {\n withFileTypes: true\n });\n var has = function has2(name2) {\n return entries.some(function(entry2) {\n return entry2.isFile() && entry2.name === name2;\n });\n };\n if (has(\"Package.swift\")) {\n var name = swiftPackageId(dir);\n var previous = packages.get(name);\n if (previous) {\n throw new Error(`[vxrn] swift packages ${previous} and ${dir} both have name ${name}`);\n }\n packages.set(name, dir);\n return;\n }\n if (dir !== root && has(\"package.json\")) return;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var entry = _step.value;\n if (!entry.isDirectory() || entry.name.startsWith(\".\") || skip.has(entry.name)) continue;\n walk(join(dir, entry.name));\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n };\n walk(root);\n return packages;\n}\nexport {\n swiftPackageDirOf,\n swiftPackageDirectories,\n swiftPackageId\n};\n//# sourceMappingURL=swiftPackageId.js.map\n"],"mappings":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,MAAM,IAAI,GAAG;IAChF,KAAK,KAAK,KAAK,MAAM,IAAI,CAAC;GAC5B;EACF,SAAS,KAAK;GACZ,oBAAoB;GACpB,iBAAiB;EACnB,UAAU;GACR,IAAI;IACF,IAAI,CAAC,6BAA6B,UAAU,UAAU,MAAM;KAC1D,UAAU,OAAO;IACnB;GACF,UAAU;IACR,IAAI,mBAAmB;KACrB,MAAM;IACR;GACF;EACF;CACF;CACA,KAAK,IAAI;CACT,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxrn",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.10",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -81,15 +81,15 @@
|
|
|
81
81
|
"@react-native-community/cli": "^20.2.0",
|
|
82
82
|
"@react-native-community/cli-config": "^20.2.0",
|
|
83
83
|
"@react-native/dev-middleware": "^0.87.1",
|
|
84
|
-
"@vxrn/compiler": "2.6.
|
|
85
|
-
"@vxrn/debug": "2.6.
|
|
86
|
-
"@vxrn/query-string": "2.6.
|
|
87
|
-
"@vxrn/resolve": "2.6.
|
|
88
|
-
"@vxrn/url-parse": "2.6.
|
|
89
|
-
"@vxrn/utils": "2.6.
|
|
90
|
-
"@vxrn/vendor": "2.6.
|
|
91
|
-
"@vxrn/vite-flow": "2.6.
|
|
92
|
-
"@vxrn/vite-plugin-metro": "2.6.
|
|
84
|
+
"@vxrn/compiler": "2.6.10",
|
|
85
|
+
"@vxrn/debug": "2.6.10",
|
|
86
|
+
"@vxrn/query-string": "2.6.10",
|
|
87
|
+
"@vxrn/resolve": "2.6.10",
|
|
88
|
+
"@vxrn/url-parse": "2.6.10",
|
|
89
|
+
"@vxrn/utils": "2.6.10",
|
|
90
|
+
"@vxrn/vendor": "2.6.10",
|
|
91
|
+
"@vxrn/vite-flow": "2.6.10",
|
|
92
|
+
"@vxrn/vite-plugin-metro": "2.6.10",
|
|
93
93
|
"citty": "^0.1.6",
|
|
94
94
|
"dotenv": "^17.2.1",
|
|
95
95
|
"dotenv-expand": "^12.0.2",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"publishConfig": {
|
|
134
134
|
"access": "public"
|
|
135
135
|
},
|
|
136
|
-
"releaseSourceCommit": "
|
|
136
|
+
"releaseSourceCommit": "5039cc0477e19b5e228772869db111e5e348b29a",
|
|
137
137
|
"repository": {
|
|
138
138
|
"type": "git",
|
|
139
139
|
"url": "git+https://github.com/onejs/one.git",
|
|
@@ -2271,6 +2271,30 @@ describe('swift cxx interop', () => {
|
|
|
2271
2271
|
expect(() => swiftPackageDirectories(root)).toThrow(/both have name my_badge/)
|
|
2272
2272
|
})
|
|
2273
2273
|
|
|
2274
|
+
it('skips swift packages inside nested javascript packages', () => {
|
|
2275
|
+
const root = mkdtempSync(join(tmpdir(), 'vxrn-swift-package-vendored-'))
|
|
2276
|
+
writeFileSync(join(root, 'package.json'), '{}')
|
|
2277
|
+
const app = join(root, 'features', 'my-badge')
|
|
2278
|
+
const vendored = join(root, 'vendor', 'sim')
|
|
2279
|
+
const fixture = join(vendored, 'test', 'fixtures', 'my-badge')
|
|
2280
|
+
mkdirSync(app, { recursive: true })
|
|
2281
|
+
mkdirSync(fixture, { recursive: true })
|
|
2282
|
+
writeFileSync(join(app, 'Package.swift'), '')
|
|
2283
|
+
writeFileSync(join(vendored, 'package.json'), '{}')
|
|
2284
|
+
writeFileSync(join(fixture, 'Package.swift'), '')
|
|
2285
|
+
expect([...swiftPackageDirectories(root)]).toEqual([['my_badge', app]])
|
|
2286
|
+
})
|
|
2287
|
+
|
|
2288
|
+
it('keeps a javascript package whose own root is a swift package', () => {
|
|
2289
|
+
const root = mkdtempSync(join(tmpdir(), 'vxrn-swift-package-workspace-'))
|
|
2290
|
+
writeFileSync(join(root, 'package.json'), '{"workspaces":["packages/*"]}')
|
|
2291
|
+
const local = join(root, 'packages', 'local-audio')
|
|
2292
|
+
mkdirSync(local, { recursive: true })
|
|
2293
|
+
writeFileSync(join(local, 'package.json'), '{"name":"@app/local-audio"}')
|
|
2294
|
+
writeFileSync(join(local, 'Package.swift'), '')
|
|
2295
|
+
expect([...swiftPackageDirectories(root)]).toEqual([['local_audio', local]])
|
|
2296
|
+
})
|
|
2297
|
+
|
|
2274
2298
|
it('emits cxx flags for swift packages', async () => {
|
|
2275
2299
|
const root = mkdtempSync(join(tmpdir(), 'vxrn-prebuild-swift-cxx-'))
|
|
2276
2300
|
const workspaceModules = fileURLToPath(
|
|
@@ -293,6 +293,17 @@ object AudioMath : OneModule {
|
|
|
293
293
|
expect(kotlin.modules[0].methods.map((method) => [method.name, method.async])).toEqual([['rms', false], ['later', true]])
|
|
294
294
|
})
|
|
295
295
|
|
|
296
|
+
it('reads class literals in kotlin annotations as arguments, not modifiers', () => {
|
|
297
|
+
const kotlin = nativeSourceContract('/app/native/Files.kt', `package app.files
|
|
298
|
+
import dev.onejs.one.source.OneModule
|
|
299
|
+
object Files : OneModule {
|
|
300
|
+
@Throws(java.io.IOException::class)
|
|
301
|
+
fun size(path: String): Int = path.length
|
|
302
|
+
@Suppress("UNCHECKED_CAST") @Throws(IllegalStateException::class, SecurityException::class) suspend fun read(path: String): String = path
|
|
303
|
+
}`)
|
|
304
|
+
expect(kotlin.modules[0].methods.map((method) => [method.name, method.async])).toEqual([['size', false], ['read', true]])
|
|
305
|
+
})
|
|
306
|
+
|
|
296
307
|
it('generates adjacent declarations and removes only obsolete generated ones', () => {
|
|
297
308
|
const root = mkdtempSync(join(tmpdir(), 'one-native-source-project-'))
|
|
298
309
|
const source = join(root, 'Audio.swift')
|
|
@@ -357,6 +357,19 @@ function declarationStart(list: Token[], floor: number, keyword: number): number
|
|
|
357
357
|
return first
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
+
// the modifier words and attribute names of a declaration. attribute arguments
|
|
361
|
+
// are values, so `@Throws(IOException::class)` contributes `@ Throws`, never `class`
|
|
362
|
+
function declarationModifiers(list: Token[], floor: number, keyword: number): string[] {
|
|
363
|
+
const words: string[] = []
|
|
364
|
+
for (let i = declarationStart(list, floor, keyword), depth = 0; i < keyword; i++) {
|
|
365
|
+
const text = list[i].text
|
|
366
|
+
if (text === '(') depth++
|
|
367
|
+
else if (text === ')') depth--
|
|
368
|
+
else if (depth === 0) words.push(text)
|
|
369
|
+
}
|
|
370
|
+
return words
|
|
371
|
+
}
|
|
372
|
+
|
|
360
373
|
// the payload of a native event subscription: a method whose only parameter
|
|
361
374
|
// is one callback over json types, `func onTick(_ callback: (Double) -> Void)`
|
|
362
375
|
// or `fun onTick(callback: (Double) -> Unit)`. a stored callback must escape,
|
|
@@ -414,7 +427,7 @@ function methods(
|
|
|
414
427
|
while (i < end) {
|
|
415
428
|
if (list[i].text === '{') { i = close(file, list, i, '{', '}') + 1; previous = i; continue }
|
|
416
429
|
if (list[i].text !== keyword) { i++; continue }
|
|
417
|
-
const modifiers =
|
|
430
|
+
const modifiers = declarationModifiers(list, previous, i)
|
|
418
431
|
const hidden = modifiers.includes('private') || modifiers.includes('fileprivate')
|
|
419
432
|
if (!hidden && (modifiers.includes('static') || modifiers.includes('class'))) {
|
|
420
433
|
fail(file, list[i], 'static native exports are unsupported')
|
|
@@ -599,7 +612,7 @@ function swiftView(
|
|
|
599
612
|
end: number,
|
|
600
613
|
named: NamedTypes
|
|
601
614
|
): NativeSourceView | null {
|
|
602
|
-
const modifiers =
|
|
615
|
+
const modifiers = declarationModifiers(list, floor, keyword)
|
|
603
616
|
if (list[keyword].text !== 'struct' || !modifiers.includes('public')) return null
|
|
604
617
|
if (!list.slice(keyword + 2, body).some((token) => token.text === 'View')) return null
|
|
605
618
|
const name = list[keyword + 1].text
|
|
@@ -693,7 +706,7 @@ function collectDataClass(
|
|
|
693
706
|
): CollectedStruct | null {
|
|
694
707
|
// the generated glue compiles into the same module, so internal stays
|
|
695
708
|
// visible; only private hides the class.
|
|
696
|
-
const modifiers =
|
|
709
|
+
const modifiers = declarationModifiers(list, 0, keyword - 1)
|
|
697
710
|
let problem: string | null = null
|
|
698
711
|
if (modifiers.includes('private')) {
|
|
699
712
|
problem = `data class ${name} must be public to cross the boundary`
|
|
@@ -1080,7 +1093,7 @@ function collectNamedTypes(
|
|
|
1080
1093
|
if (isSwiftStruct) {
|
|
1081
1094
|
const inherits = header.map((entry) => entry.text)
|
|
1082
1095
|
// a file-private struct hides from the generated glue in its own module
|
|
1083
|
-
const modifiers =
|
|
1096
|
+
const modifiers = declarationModifiers(list, 0, i)
|
|
1084
1097
|
structs.push({
|
|
1085
1098
|
name,
|
|
1086
1099
|
token,
|
|
@@ -1124,7 +1137,7 @@ function composableView(
|
|
|
1124
1137
|
floor: number,
|
|
1125
1138
|
named: NamedTypes
|
|
1126
1139
|
): NativeSourceView | null {
|
|
1127
|
-
const modifiers =
|
|
1140
|
+
const modifiers = declarationModifiers(list, floor, keyword)
|
|
1128
1141
|
if (!modifiers.some((value, index) => value === '@' && modifiers[index + 1] === 'Composable')) return null
|
|
1129
1142
|
if (modifiers.includes('private') || modifiers.includes('internal')) return null
|
|
1130
1143
|
const name = list[keyword + 1]?.text
|
|
@@ -13,13 +13,17 @@ export function swiftPackageDirOf(file: string): string | undefined {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
// prebuild and dev servers must address the same package by the same name.
|
|
16
|
+
// prebuild and dev servers must address the same package by the same name. a
|
|
17
|
+
// javascript package whose own root holds Package.swift is a swift package of
|
|
18
|
+
// this app; any other nested package.json marks another javascript package
|
|
19
|
+
// (vendored or a fixture) whose inner swift belongs to it, not this app.
|
|
17
20
|
export function swiftPackageDirectories(root: string): Map<string, string> {
|
|
18
21
|
const skip = new Set(['node_modules', 'ios', 'android', 'dist', 'types', 'build'])
|
|
19
22
|
const packages = new Map<string, string>()
|
|
20
23
|
const walk = (dir: string) => {
|
|
21
24
|
const entries = readdirSync(dir, { withFileTypes: true })
|
|
22
|
-
|
|
25
|
+
const has = (name: string) => entries.some((entry) => entry.isFile() && entry.name === name)
|
|
26
|
+
if (has('Package.swift')) {
|
|
23
27
|
const name = swiftPackageId(dir)
|
|
24
28
|
const previous = packages.get(name)
|
|
25
29
|
if (previous) {
|
|
@@ -28,6 +32,7 @@ export function swiftPackageDirectories(root: string): Map<string, string> {
|
|
|
28
32
|
packages.set(name, dir)
|
|
29
33
|
return
|
|
30
34
|
}
|
|
35
|
+
if (dir !== root && has('package.json')) return
|
|
31
36
|
for (const entry of entries) {
|
|
32
37
|
if (!entry.isDirectory() || entry.name.startsWith('.') || skip.has(entry.name)) continue
|
|
33
38
|
walk(join(dir, entry.name))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeSourceContract.d.ts","sourceRoot":"","sources":["../../src/utils/nativeSourceContract.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,gBAAgB,CAAA;KAAE,EAAE,CAAA;IAC/G,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAG7B,YAAY,CAAC,EAAE;QAAE,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,gBAAgB,CAAA;SAAE,EAAE,CAAA;KAAE,CAAA;IAC3F,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAC9B;AAMD,MAAM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oOlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swiftPackageId.d.ts","sourceRoot":"","sources":["../../src/utils/swiftPackageId.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,UAEhD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIlE;
|
|
1
|
+
{"version":3,"file":"swiftPackageId.d.ts","sourceRoot":"","sources":["../../src/utils/swiftPackageId.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,UAEhD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIlE;AAMD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAuBzE"}
|