expo-modules-macros 0.25.0 → 0.27.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/AGENTS.md +8 -8
- package/README.md +40 -3
- package/apple/ExpoModulesMacros +0 -0
- package/apple/Package.swift +10 -4
- package/apple/Sources/{ExpoModulesScanner → ExpoModulesCLI}/CLI.swift +45 -2
- package/apple/Sources/ExpoModulesCLI/Commands/Expand/ExpandReport.swift +120 -0
- package/apple/Sources/ExpoModulesCLI/Commands/Expand/RunExpand.swift +183 -0
- package/apple/Sources/{ExpoModulesScanner/Exports → ExpoModulesCLI/Commands/ScanExports}/ExportedSurface.swift +3 -2
- package/apple/Sources/{ExpoModulesScanner/Exports → ExpoModulesCLI/Commands/ScanExports}/ResolveRefs.swift +9 -0
- package/apple/Sources/{ExpoModulesScanner/Exports → ExpoModulesCLI/Commands/ScanExports}/SurfaceVisitor.swift +10 -3
- package/apple/Sources/ExpoModulesCLI/Commands/ScanExports/TupleTypeAliases.swift +126 -0
- package/apple/Sources/{ExpoModulesScanner/Exports → ExpoModulesCLI/Commands/ScanExports}/TypeNode.swift +47 -4
- package/apple/Sources/{ExpoModulesScanner → ExpoModulesCLI}/Core/SourceScan.swift +8 -2
- package/apple/Sources/ExpoModulesMacros/Expand/MacroExpander.swift +484 -0
- package/apple/Sources/ExpoModulesMacros/{EventMacro.swift → Macros/EventMacro.swift} +23 -10
- package/apple/Sources/ExpoModulesMacros/{ExpoModuleMacro.swift → Macros/ExpoModuleMacro.swift} +13 -1
- package/apple/Sources/ExpoModulesMacros/{JSMacro.swift → Macros/JSMacro.swift} +71 -54
- package/apple/Sources/ExpoModulesMacros/{RecordMacro.swift → Macros/RecordMacro.swift} +18 -5
- package/apple/Sources/ExpoModulesMacros/{SharedObjectMacro.swift → Macros/SharedObjectMacro.swift} +13 -1
- package/apple/Sources/ExpoModulesMacros/{UnionMacro.swift → Macros/UnionMacro.swift} +16 -5
- package/apple/Sources/ExpoModulesMacros/Plugin.swift +9 -14
- package/apple/Sources/ExpoModulesMacros/ProvidedMacros.swift +31 -0
- package/apple/Sources/ExpoModulesMacros/{ClosureArguments.swift → Support/ClosureArguments.swift} +30 -4
- package/apple/Sources/ExpoModulesMacros/{DecorateModuleBuilder.swift → Support/DecorateModuleBuilder.swift} +5 -1
- package/apple/Sources/ExpoModulesMacros/{MacroHelpers.swift → Support/MacroHelpers.swift} +11 -4
- package/apple/Sources/ExpoModulesMacros/Support/TupleTypes.swift +272 -0
- package/apple/Sources/ExpoModulesMacros/Support/TypeAliases.swift +75 -0
- package/apple/Sources/ExpoModulesMacros/{TypeConformanceAssertion.swift → Support/TypeConformanceAssertion.swift} +104 -41
- package/build/index.d.ts +31 -1
- package/build/index.js +34 -0
- package/build/types.d.ts +77 -2
- package/build/types.js +4 -3
- package/package.json +5 -5
- /package/apple/Sources/{ExpoModulesScanner/Exports → ExpoModulesCLI/Commands/ScanExports}/Availability.swift +0 -0
- /package/apple/Sources/{ExpoModulesScanner/Exports → ExpoModulesCLI/Commands/ScanExports}/ScanExports.swift +0 -0
- /package/apple/Sources/{ExpoModulesScanner/Modules → ExpoModulesCLI/Commands/ScanModules}/ScanModules.swift +0 -0
- /package/apple/Sources/{ExpoModulesScanner → ExpoModulesCLI}/Core/Detection.swift +0 -0
- /package/apple/Sources/{ExpoModulesScanner → ExpoModulesCLI}/Core/DetectionVisitor.swift +0 -0
- /package/apple/Sources/{ExpoModulesScanner → ExpoModulesCLI}/Core/ScanBuildConfiguration.swift +0 -0
- /package/apple/Sources/{ExpoModulesScanner → ExpoModulesCLI}/Core/StandardStreams.swift +0 -0
- /package/apple/Sources/ExpoModulesMacros/{ExpoModulesOptimizedMacro.swift → Macros/ExpoModulesOptimizedMacro.swift} +0 -0
- /package/apple/Sources/ExpoModulesMacros/{ExpoViewMacro.swift → Macros/ExpoViewMacro.swift} +0 -0
- /package/apple/Sources/ExpoModulesMacros/{ViewPropsMacro.swift → Macros/ViewPropsMacro.swift} +0 -0
- /package/apple/Sources/ExpoModulesMacros/{FreeFormTypes.swift → Support/FreeFormTypes.swift} +0 -0
- /package/apple/Sources/ExpoModulesMacros/{JSConstructor.swift → Support/JSConstructor.swift} +0 -0
- /package/apple/Sources/ExpoModulesMacros/{JSNameCollisions.swift → Support/JSNameCollisions.swift} +0 -0
- /package/apple/Sources/ExpoModulesMacros/{OptimizedFunctionHelpers.swift → Support/OptimizedFunctionHelpers.swift} +0 -0
- /package/apple/Sources/ExpoModulesMacros/{Receiver.swift → Support/Receiver.swift} +0 -0
package/build/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hand-written mirrors of the scanner's JSON output. The Swift `Codable` types in
|
|
3
|
-
* `apple/Sources/
|
|
3
|
+
* `apple/Sources/ExpoModulesCLI` are the source of truth; these are kept in sync by hand, which
|
|
4
4
|
* is why each command carries a `schemaVersion` the wrapper checks at runtime.
|
|
5
5
|
*/
|
|
6
6
|
/** The JS `typeof` category a boundary type reports, mirroring `JSType`. */
|
|
@@ -61,6 +61,37 @@ export type TypeNode = {
|
|
|
61
61
|
name: string;
|
|
62
62
|
refKind?: 'record' | 'sharedObject' | 'enum' | 'union';
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* An unlabeled Swift tuple of two or more elements, `(A, B)`. It crosses as an array with one value per
|
|
66
|
+
* element, like a TypeScript tuple.
|
|
67
|
+
*/
|
|
68
|
+
| {
|
|
69
|
+
kind: 'tuple';
|
|
70
|
+
typeof: JSType;
|
|
71
|
+
elements: TypeNode[];
|
|
72
|
+
/**
|
|
73
|
+
* The qualified name of the type alias the tuple was written through, such as `MyModule.Pair`.
|
|
74
|
+
* Absent when the tuple is spelled out.
|
|
75
|
+
*/
|
|
76
|
+
name?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* An object with a fixed set of properties. A labeled Swift tuple of two or more elements,
|
|
80
|
+
* `(x: A, y: B)`, crosses as one, with one property per label.
|
|
81
|
+
*/
|
|
82
|
+
| {
|
|
83
|
+
kind: 'object';
|
|
84
|
+
typeof: JSType;
|
|
85
|
+
properties: {
|
|
86
|
+
name: string;
|
|
87
|
+
type: TypeNode;
|
|
88
|
+
}[];
|
|
89
|
+
/**
|
|
90
|
+
* The qualified name of the type alias the labeled tuple was written through, such as
|
|
91
|
+
* `MyModule.Span`. Absent when the tuple is spelled out.
|
|
92
|
+
*/
|
|
93
|
+
name?: string;
|
|
94
|
+
}
|
|
64
95
|
/**
|
|
65
96
|
* `SharedRef<T>`: a shared object that JS sees as an instance of `expo.SharedRef`. `native` is the
|
|
66
97
|
* `T` it holds on the native side. It never reaches JS, so refs in it are not resolved.
|
|
@@ -383,10 +414,54 @@ export interface ScanExportsResult {
|
|
|
383
414
|
exports: ExportedSurface;
|
|
384
415
|
stats: ScanStats;
|
|
385
416
|
}
|
|
417
|
+
/** A note attached to an `ExpansionDiagnostic`, at its own location. */
|
|
418
|
+
export interface ExpansionNote {
|
|
419
|
+
message: string;
|
|
420
|
+
line: number;
|
|
421
|
+
column: number;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* A syntax error in a file or a diagnostic of a macro, at its location in the original file. `line`
|
|
425
|
+
* and `column` are 1-based, and the column counts UTF-8 bytes, as in the compiler's output.
|
|
426
|
+
*/
|
|
427
|
+
export interface ExpansionDiagnostic {
|
|
428
|
+
severity: 'error' | 'warning' | 'note' | 'remark';
|
|
429
|
+
message: string;
|
|
430
|
+
line: number;
|
|
431
|
+
column: number;
|
|
432
|
+
notes: ExpansionNote[];
|
|
433
|
+
/** The messages of the Fix-Its, for example `replace 'var' with 'let'`. */
|
|
434
|
+
fixIts: string[];
|
|
435
|
+
}
|
|
436
|
+
/** Expanded source code. */
|
|
437
|
+
export interface Expansion {
|
|
438
|
+
/** The symbol this expansion is for, or absent for the whole file. */
|
|
439
|
+
symbol?: string;
|
|
440
|
+
source: string;
|
|
441
|
+
}
|
|
442
|
+
/** What the macros generate for one file, and what they report about it. */
|
|
443
|
+
export interface ExpandedFile {
|
|
444
|
+
/** The path as it was passed, or the absolute path of a file found in a directory. */
|
|
445
|
+
file: string;
|
|
446
|
+
/**
|
|
447
|
+
* Without symbols, one expansion of the whole file. With symbols, one per symbol that this file
|
|
448
|
+
* declares, in the order they were passed. Empty with `diagnosticsOnly`.
|
|
449
|
+
*/
|
|
450
|
+
expansions: Expansion[];
|
|
451
|
+
/** In source order. With symbols, only those inside the declarations of the symbols. */
|
|
452
|
+
diagnostics: ExpansionDiagnostic[];
|
|
453
|
+
}
|
|
454
|
+
/** The `expand --json` result. */
|
|
455
|
+
export interface ExpandResult {
|
|
456
|
+
schemaVersion: number;
|
|
457
|
+
/** One entry per expanded file: the files in the order they were passed, a directory's files sorted. */
|
|
458
|
+
files: ExpandedFile[];
|
|
459
|
+
}
|
|
386
460
|
/**
|
|
387
461
|
* The output schema versions this package was written against. The wrapper compares these to the
|
|
388
462
|
* `schemaVersion` in each report and throws on a mismatch, so a binary/wrapper version skew surfaces
|
|
389
463
|
* as a clear error instead of silently misread fields.
|
|
390
464
|
*/
|
|
391
465
|
export declare const SUPPORTED_SCAN_MODULES_SCHEMA_VERSION = 2;
|
|
392
|
-
export declare const SUPPORTED_SCAN_EXPORTS_SCHEMA_VERSION =
|
|
466
|
+
export declare const SUPPORTED_SCAN_EXPORTS_SCHEMA_VERSION = 10;
|
|
467
|
+
export declare const SUPPORTED_EXPAND_SCHEMA_VERSION = 1;
|
package/build/types.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Hand-written mirrors of the scanner's JSON output. The Swift `Codable` types in
|
|
4
|
-
* `apple/Sources/
|
|
4
|
+
* `apple/Sources/ExpoModulesCLI` are the source of truth; these are kept in sync by hand, which
|
|
5
5
|
* is why each command carries a `schemaVersion` the wrapper checks at runtime.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.SUPPORTED_SCAN_EXPORTS_SCHEMA_VERSION = exports.SUPPORTED_SCAN_MODULES_SCHEMA_VERSION = void 0;
|
|
8
|
+
exports.SUPPORTED_EXPAND_SCHEMA_VERSION = exports.SUPPORTED_SCAN_EXPORTS_SCHEMA_VERSION = exports.SUPPORTED_SCAN_MODULES_SCHEMA_VERSION = void 0;
|
|
9
9
|
/**
|
|
10
10
|
* The output schema versions this package was written against. The wrapper compares these to the
|
|
11
11
|
* `schemaVersion` in each report and throws on a mismatch, so a binary/wrapper version skew surfaces
|
|
12
12
|
* as a clear error instead of silently misread fields.
|
|
13
13
|
*/
|
|
14
14
|
exports.SUPPORTED_SCAN_MODULES_SCHEMA_VERSION = 2;
|
|
15
|
-
exports.SUPPORTED_SCAN_EXPORTS_SCHEMA_VERSION =
|
|
15
|
+
exports.SUPPORTED_SCAN_EXPORTS_SCHEMA_VERSION = 10;
|
|
16
|
+
exports.SUPPORTED_EXPAND_SCHEMA_VERSION = 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-macros",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Swift macro plugin for Expo modules",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"typescript": "^5.4.0"
|
|
27
27
|
},
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@expo/modules-macros-linux-arm64": "0.
|
|
30
|
-
"@expo/modules-macros-linux-x64": "0.
|
|
31
|
-
"@expo/modules-macros-win32-arm64": "0.
|
|
32
|
-
"@expo/modules-macros-win32-x64": "0.
|
|
29
|
+
"@expo/modules-macros-linux-arm64": "0.27.0",
|
|
30
|
+
"@expo/modules-macros-linux-x64": "0.27.0",
|
|
31
|
+
"@expo/modules-macros-win32-arm64": "0.27.0",
|
|
32
|
+
"@expo/modules-macros-win32-x64": "0.27.0"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/apple/Sources/{ExpoModulesScanner → ExpoModulesCLI}/Core/ScanBuildConfiguration.swift
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/apple/Sources/ExpoModulesMacros/{ViewPropsMacro.swift → Macros/ViewPropsMacro.swift}
RENAMED
|
File without changes
|
/package/apple/Sources/ExpoModulesMacros/{FreeFormTypes.swift → Support/FreeFormTypes.swift}
RENAMED
|
File without changes
|
/package/apple/Sources/ExpoModulesMacros/{JSConstructor.swift → Support/JSConstructor.swift}
RENAMED
|
File without changes
|
/package/apple/Sources/ExpoModulesMacros/{JSNameCollisions.swift → Support/JSNameCollisions.swift}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|