oxc-transform 0.53.0 → 0.55.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.
Files changed (3) hide show
  1. package/index.d.ts +53 -0
  2. package/index.js +1 -0
  3. package/package.json +9 -9
package/index.d.ts CHANGED
@@ -199,6 +199,59 @@ export interface JsxOptions {
199
199
  refresh?: boolean | ReactRefreshOptions
200
200
  }
201
201
 
202
+ /**
203
+ * Transform JavaScript code to a Vite Node runnable module.
204
+ *
205
+ * @param filename The name of the file being transformed.
206
+ * @param sourceText the source code itself
207
+ * @param options The options for the transformation. See {@link
208
+ * ModuleRunnerTransformOptions} for more information.
209
+ *
210
+ * @returns an object containing the transformed code, source maps, and any
211
+ * errors that occurred during parsing or transformation.
212
+ *
213
+ * @deprecated Only works for Vite.
214
+ */
215
+ export declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): ModuleRunnerTransformResult
216
+
217
+ export interface ModuleRunnerTransformOptions {
218
+ /**
219
+ * Enable source map generation.
220
+ *
221
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
222
+ *
223
+ * @default false
224
+ *
225
+ * @see {@link SourceMap}
226
+ */
227
+ sourcemap?: boolean
228
+ }
229
+
230
+ export interface ModuleRunnerTransformResult {
231
+ /**
232
+ * The transformed code.
233
+ *
234
+ * If parsing failed, this will be an empty string.
235
+ */
236
+ code: string
237
+ /**
238
+ * The source map for the transformed code.
239
+ *
240
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
241
+ */
242
+ map?: SourceMap
243
+ deps: Array<string>
244
+ dynamicDeps: Array<string>
245
+ /**
246
+ * Parse and transformation errors.
247
+ *
248
+ * Oxc's parser recovers from common syntax errors, meaning that
249
+ * transformed code may still be available even if there are errors in this
250
+ * list.
251
+ */
252
+ errors: Array<OxcError>
253
+ }
254
+
202
255
  export interface OxcError {
203
256
  severity: Severity
204
257
  message: string
package/index.js CHANGED
@@ -372,5 +372,6 @@ if (!nativeBinding) {
372
372
 
373
373
  module.exports.HelperMode = nativeBinding.HelperMode
374
374
  module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration
375
+ module.exports.moduleRunnerTransform = nativeBinding.moduleRunnerTransform
375
376
  module.exports.Severity = nativeBinding.Severity
376
377
  module.exports.transform = nativeBinding.transform
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxc-transform",
3
- "version": "0.53.0",
3
+ "version": "0.55.0",
4
4
  "description": "Oxc transform Node API",
5
5
  "keywords": [
6
6
  "transform"
@@ -23,13 +23,13 @@
23
23
  "index.js"
24
24
  ],
25
25
  "optionalDependencies": {
26
- "@oxc-transform/binding-win32-x64-msvc": "0.53.0",
27
- "@oxc-transform/binding-win32-arm64-msvc": "0.53.0",
28
- "@oxc-transform/binding-linux-x64-gnu": "0.53.0",
29
- "@oxc-transform/binding-linux-arm64-gnu": "0.53.0",
30
- "@oxc-transform/binding-linux-x64-musl": "0.53.0",
31
- "@oxc-transform/binding-linux-arm64-musl": "0.53.0",
32
- "@oxc-transform/binding-darwin-x64": "0.53.0",
33
- "@oxc-transform/binding-darwin-arm64": "0.53.0"
26
+ "@oxc-transform/binding-win32-x64-msvc": "0.55.0",
27
+ "@oxc-transform/binding-win32-arm64-msvc": "0.55.0",
28
+ "@oxc-transform/binding-linux-x64-gnu": "0.55.0",
29
+ "@oxc-transform/binding-linux-arm64-gnu": "0.55.0",
30
+ "@oxc-transform/binding-linux-x64-musl": "0.55.0",
31
+ "@oxc-transform/binding-linux-arm64-musl": "0.55.0",
32
+ "@oxc-transform/binding-darwin-x64": "0.55.0",
33
+ "@oxc-transform/binding-darwin-arm64": "0.55.0"
34
34
  }
35
35
  }