Skip to content

Commit d9b0a28

Browse files
BridgeJS: Make @JSClass, @JSFunction, etc generally available without @_spi(Experimental)
1 parent 9ab70c6 commit d9b0a28

File tree

14 files changed

+36
-40
lines changed

14 files changed

+36
-40
lines changed

Benchmarks/Sources/Generated/BridgeJS.Macros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// To update this file, just rebuild your project or run
55
// `swift package bridge-js`.
66

7-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
7+
@_spi(BridgeJS) import JavaScriptKit
88

99
@JSFunction func benchmarkHelperNoop() throws(JSException) -> Void
1010

Examples/PlayBridgeJS/Sources/PlayBridgeJS/Generated/BridgeJS.Macros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// To update this file, just rebuild your project or run
55
// `swift package bridge-js`.
66

7-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
7+
@_spi(BridgeJS) import JavaScriptKit
88

99
@JSFunction func createTS2Swift() throws(JSException) -> TS2Swift
1010

Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function run(filePath, options) {
123123
"// To update this file, just rebuild your project or run",
124124
"// `swift package bridge-js`.",
125125
"",
126-
"@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit",
126+
"@_spi(BridgeJS) import JavaScriptKit",
127127
"",
128128
"",
129129
].join("\n");

Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports[`ts2swift > snapshots Swift output for ArrayParameter.d.ts > ArrayParame
77
// To update this file, just rebuild your project or run
88
// \`swift package bridge-js\`.
99
10-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
10+
@_spi(BridgeJS) import JavaScriptKit
1111
1212
@JSFunction func processNumbers(_ values: [Double]) throws(JSException) -> Void
1313
@@ -30,7 +30,7 @@ exports[`ts2swift > snapshots Swift output for Async.d.ts > Async 1`] = `
3030
// To update this file, just rebuild your project or run
3131
// \`swift package bridge-js\`.
3232
33-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
33+
@_spi(BridgeJS) import JavaScriptKit
3434
3535
@JSFunction func asyncReturnVoid() throws(JSException) -> JSPromise
3636
@@ -55,7 +55,7 @@ exports[`ts2swift > snapshots Swift output for Documentation.d.ts > Documentatio
5555
// To update this file, just rebuild your project or run
5656
// \`swift package bridge-js\`.
5757
58-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
58+
@_spi(BridgeJS) import JavaScriptKit
5959
6060
/// Return a greeting for a user.
6161
///
@@ -112,7 +112,7 @@ exports[`ts2swift > snapshots Swift output for Interface.d.ts > Interface 1`] =
112112
// To update this file, just rebuild your project or run
113113
// \`swift package bridge-js\`.
114114
115-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
115+
@_spi(BridgeJS) import JavaScriptKit
116116
117117
@JSFunction func returnAnimatable() throws(JSException) -> Animatable
118118
@@ -130,7 +130,7 @@ exports[`ts2swift > snapshots Swift output for InvalidPropertyNames.d.ts > Inval
130130
// To update this file, just rebuild your project or run
131131
// \`swift package bridge-js\`.
132132
133-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
133+
@_spi(BridgeJS) import JavaScriptKit
134134
135135
@JSFunction func createArrayBuffer() throws(JSException) -> ArrayBufferLike
136136
@@ -178,7 +178,7 @@ exports[`ts2swift > snapshots Swift output for MultipleImportedTypes.d.ts > Mult
178178
// To update this file, just rebuild your project or run
179179
// \`swift package bridge-js\`.
180180
181-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
181+
@_spi(BridgeJS) import JavaScriptKit
182182
183183
@JSFunction func createDatabaseConnection(_ config: JSValue) throws(JSException) -> DatabaseConnection
184184
@@ -215,7 +215,7 @@ exports[`ts2swift > snapshots Swift output for ObjectLikeTypes.d.ts > ObjectLike
215215
// To update this file, just rebuild your project or run
216216
// \`swift package bridge-js\`.
217217
218-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
218+
@_spi(BridgeJS) import JavaScriptKit
219219
220220
@JSFunction func acceptObject(_ v: JSObject) throws(JSException) -> Void
221221
"
@@ -228,7 +228,7 @@ exports[`ts2swift > snapshots Swift output for OptionalNullUndefined.d.ts > Opti
228228
// To update this file, just rebuild your project or run
229229
// \`swift package bridge-js\`.
230230
231-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
231+
@_spi(BridgeJS) import JavaScriptKit
232232
233233
@JSFunction func roundTripNumberNull(_ value: Optional<Double>) throws(JSException) -> Optional<Double>
234234
@@ -269,7 +269,7 @@ exports[`ts2swift > snapshots Swift output for PrimitiveParameters.d.ts > Primit
269269
// To update this file, just rebuild your project or run
270270
// \`swift package bridge-js\`.
271271
272-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
272+
@_spi(BridgeJS) import JavaScriptKit
273273
274274
@JSFunction func check(_ a: Double, _ b: Bool) throws(JSException) -> Void
275275
"
@@ -282,7 +282,7 @@ exports[`ts2swift > snapshots Swift output for PrimitiveReturn.d.ts > PrimitiveR
282282
// To update this file, just rebuild your project or run
283283
// \`swift package bridge-js\`.
284284
285-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
285+
@_spi(BridgeJS) import JavaScriptKit
286286
287287
@JSFunction func checkNumber() throws(JSException) -> Double
288288
@@ -297,7 +297,7 @@ exports[`ts2swift > snapshots Swift output for ReExportFrom.d.ts > ReExportFrom
297297
// To update this file, just rebuild your project or run
298298
// \`swift package bridge-js\`.
299299
300-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
300+
@_spi(BridgeJS) import JavaScriptKit
301301
302302
@JSFunction func jsRoundTripNumber(_ v: Double) throws(JSException) -> Double
303303
@@ -315,7 +315,7 @@ exports[`ts2swift > snapshots Swift output for RecordDictionary.d.ts > RecordDic
315315
// To update this file, just rebuild your project or run
316316
// \`swift package bridge-js\`.
317317
318-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
318+
@_spi(BridgeJS) import JavaScriptKit
319319
320320
@JSFunction func takeRecord(_ value: [String: Double]) throws(JSException) -> Void
321321
@@ -345,7 +345,7 @@ exports[`ts2swift > snapshots Swift output for StringEnum.d.ts > StringEnum 1`]
345345
// To update this file, just rebuild your project or run
346346
// \`swift package bridge-js\`.
347347
348-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
348+
@_spi(BridgeJS) import JavaScriptKit
349349
350350
enum FeatureFlag: String {
351351
case foo = "foo"
@@ -366,7 +366,7 @@ exports[`ts2swift > snapshots Swift output for StringParameter.d.ts > StringPara
366366
// To update this file, just rebuild your project or run
367367
// \`swift package bridge-js\`.
368368
369-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
369+
@_spi(BridgeJS) import JavaScriptKit
370370
371371
@JSFunction func checkString(_ a: String) throws(JSException) -> Void
372372
@@ -381,7 +381,7 @@ exports[`ts2swift > snapshots Swift output for StringReturn.d.ts > StringReturn
381381
// To update this file, just rebuild your project or run
382382
// \`swift package bridge-js\`.
383383
384-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
384+
@_spi(BridgeJS) import JavaScriptKit
385385
386386
@JSFunction func checkString() throws(JSException) -> String
387387
"
@@ -394,7 +394,7 @@ exports[`ts2swift > snapshots Swift output for TS2SkeletonLike.d.ts > TS2Skeleto
394394
// To update this file, just rebuild your project or run
395395
// \`swift package bridge-js\`.
396396
397-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
397+
@_spi(BridgeJS) import JavaScriptKit
398398
399399
@JSFunction func createTS2Skeleton() throws(JSException) -> TypeScriptProcessor
400400
@@ -420,7 +420,7 @@ exports[`ts2swift > snapshots Swift output for TypeAlias.d.ts > TypeAlias 1`] =
420420
// To update this file, just rebuild your project or run
421421
// \`swift package bridge-js\`.
422422
423-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
423+
@_spi(BridgeJS) import JavaScriptKit
424424
425425
@JSFunction func checkSimple(_ a: Double) throws(JSException) -> Void
426426
"
@@ -433,7 +433,7 @@ exports[`ts2swift > snapshots Swift output for TypeScriptClass.d.ts > TypeScript
433433
// To update this file, just rebuild your project or run
434434
// \`swift package bridge-js\`.
435435
436-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
436+
@_spi(BridgeJS) import JavaScriptKit
437437
438438
@JSClass struct Greeter {
439439
@JSGetter var name: String
@@ -454,7 +454,7 @@ exports[`ts2swift > snapshots Swift output for VoidParameterVoidReturn.d.ts > Vo
454454
// To update this file, just rebuild your project or run
455455
// \`swift package bridge-js\`.
456456
457-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
457+
@_spi(BridgeJS) import JavaScriptKit
458458
459459
@JSFunction func check() throws(JSException) -> Void
460460
"
@@ -467,7 +467,7 @@ exports[`ts2swift > snapshots Swift output for WebIDLDOMDocs.d.ts > WebIDLDOMDoc
467467
// To update this file, just rebuild your project or run
468468
// \`swift package bridge-js\`.
469469
470-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
470+
@_spi(BridgeJS) import JavaScriptKit
471471
472472
/// [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document)
473473
@JSGetter var document: Document

Sources/JavaScriptKit/Macros.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Bui
125125
/// Example:
126126
///
127127
/// ```swift
128-
/// @_spi(Experimental) import JavaScriptKit
128+
/// import JavaScriptKit
129129
///
130130
/// @JSGetter var count: Int
131131
///
@@ -137,7 +137,6 @@ public macro JS(namespace: String? = nil, enumStyle: JSEnumStyle = .const) = Bui
137137
/// - Parameter from: Selects where the property is read from.
138138
/// Use `.global` to read from `globalThis` (e.g. `console`, `document`).
139139
@attached(accessor)
140-
@_spi(Experimental)
141140
public macro JSGetter(jsName: String? = nil, from: JSImportFrom? = nil) =
142141
#externalMacro(module: "BridgeJSMacros", type: "JSGetterMacro")
143142

@@ -151,12 +150,11 @@ public macro JSGetter(jsName: String? = nil, from: JSImportFrom? = nil) =
151150
/// Example:
152151
///
153152
/// ```swift
154-
/// @_spi(Experimental) import JavaScriptKit
153+
/// import JavaScriptKit
155154
///
156155
/// @JSSetter func setName(_ value: String) throws (JSException)
157156
/// ```
158157
@attached(body)
159-
@_spi(Experimental)
160158
public macro JSSetter(jsName: String? = nil, from: JSImportFrom? = nil) =
161159
#externalMacro(module: "BridgeJSMacros", type: "JSSetterMacro")
162160

@@ -167,7 +165,7 @@ public macro JSSetter(jsName: String? = nil, from: JSImportFrom? = nil) =
167165
/// Example:
168166
///
169167
/// ```swift
170-
/// @_spi(Experimental) import JavaScriptKit
168+
/// import JavaScriptKit
171169
///
172170
/// @JSFunction func greet() throws (JSException) -> String
173171
/// @JSFunction init(_ name: String) throws (JSException)
@@ -178,7 +176,6 @@ public macro JSSetter(jsName: String? = nil, from: JSImportFrom? = nil) =
178176
/// - Parameter from: Selects where the function is looked up from.
179177
/// Use `.global` to call a function on `globalThis` (e.g. `setTimeout`).
180178
@attached(body)
181-
@_spi(Experimental)
182179
public macro JSFunction(jsName: String? = nil, from: JSImportFrom? = nil) =
183180
#externalMacro(module: "BridgeJSMacros", type: "JSFunctionMacro")
184181

@@ -189,7 +186,7 @@ public macro JSFunction(jsName: String? = nil, from: JSImportFrom? = nil) =
189186
/// Example:
190187
///
191188
/// ```swift
192-
/// @_spi(Experimental) import JavaScriptKit
189+
/// import JavaScriptKit
193190
///
194191
/// @JSClass
195192
/// struct JsGreeter {
@@ -204,6 +201,5 @@ public macro JSFunction(jsName: String? = nil, from: JSImportFrom? = nil) =
204201
/// Use `.global` to construct globals like `WebSocket` via `globalThis`.
205202
@attached(member, names: named(jsObject), named(init(unsafelyWrapping:)))
206203
@attached(extension, conformances: _JSBridgedClass)
207-
@_spi(Experimental)
208204
public macro JSClass(jsName: String? = nil, from: JSImportFrom? = nil) =
209205
#externalMacro(module: "BridgeJSMacros", type: "JSClassMacro")

Tests/BridgeJSRuntimeTests/ClosureSupportTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import XCTest
2-
@_spi(Experimental) import JavaScriptKit
2+
import JavaScriptKit
33

44
@JSClass struct ClosureSupportImports {
55

Tests/BridgeJSRuntimeTests/DictionaryTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
1+
@_spi(BridgeJS) import JavaScriptKit
22
import XCTest
33

44
final class DictionaryTests: XCTestCase {

Tests/BridgeJSRuntimeTests/ExportAPITests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import XCTest
2-
@_spi(Experimental) import JavaScriptKit
2+
import JavaScriptKit
33
import JavaScriptEventLoop
44

55
@_extern(wasm, module: "BridgeJSRuntimeTests", name: "runJsWorks")

Tests/BridgeJSRuntimeTests/Generated/BridgeJS.Macros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// To update this file, just rebuild your project or run
55
// `swift package bridge-js`.
66

7-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
7+
@_spi(BridgeJS) import JavaScriptKit
88

99
@JSFunction func jsRoundTripVoid() throws(JSException) -> Void
1010

Tests/BridgeJSRuntimeTests/ImportArrayAPIs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@_spi(Experimental) @_spi(BridgeJS) import JavaScriptKit
1+
@_spi(BridgeJS) import JavaScriptKit
22

33
@JSFunction func jsRoundTripIntArray(_ items: [Int]) throws(JSException) -> [Int]
44
@JSFunction func jsArrayLength(_ items: [Int]) throws(JSException) -> Int

0 commit comments

Comments
 (0)