oxc-transform 0.75.1 → 0.77.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 (2) hide show
  1. package/index.d.ts +87 -2
  2. package/package.json +17 -16
package/index.d.ts CHANGED
@@ -323,6 +323,10 @@ export interface ModuleRunnerTransformResult {
323
323
  errors: Array<OxcError>
324
324
  }
325
325
 
326
+ export interface PluginsOptions {
327
+ styledComponents?: StyledComponentsOptions
328
+ }
329
+
326
330
  export interface ReactRefreshOptions {
327
331
  /**
328
332
  * Specify the identifier of the refresh registration variable.
@@ -339,6 +343,85 @@ export interface ReactRefreshOptions {
339
343
  emitFullSignatures?: boolean
340
344
  }
341
345
 
346
+ /**
347
+ * Configure how styled-components are transformed.
348
+ *
349
+ * @see {@link https://styled-components.com/docs/tooling#babel-plugin}
350
+ */
351
+ export interface StyledComponentsOptions {
352
+ /**
353
+ * Enhances the attached CSS class name on each component with richer output to help
354
+ * identify your components in the DOM without React DevTools.
355
+ *
356
+ * @default true
357
+ */
358
+ displayName?: boolean
359
+ /**
360
+ * Controls whether the `displayName` of a component will be prefixed with the filename
361
+ * to make the component name as unique as possible.
362
+ *
363
+ * @default true
364
+ */
365
+ fileName?: boolean
366
+ /**
367
+ * Adds a unique identifier to every styled component to avoid checksum mismatches
368
+ * due to different class generation on the client and server during server-side rendering.
369
+ *
370
+ * @default true
371
+ */
372
+ ssr?: boolean
373
+ /**
374
+ * Transpiles styled-components tagged template literals to a smaller representation
375
+ * than what Babel normally creates, helping to reduce bundle size.
376
+ *
377
+ * @default true
378
+ */
379
+ transpileTemplateLiterals?: boolean
380
+ /**
381
+ * Minifies CSS content by removing all whitespace and comments from your CSS,
382
+ * keeping valuable bytes out of your bundles.
383
+ *
384
+ * @default true
385
+ */
386
+ minify?: boolean
387
+ /**
388
+ * Enables transformation of JSX `css` prop when using styled-components.
389
+ *
390
+ * **Note: This feature is not yet implemented in oxc.**
391
+ *
392
+ * @default true
393
+ */
394
+ cssProp?: boolean
395
+ /**
396
+ * Enables "pure annotation" to aid dead code elimination by bundlers.
397
+ *
398
+ * @default false
399
+ */
400
+ pure?: boolean
401
+ /**
402
+ * Adds a namespace prefix to component identifiers to ensure class names are unique.
403
+ *
404
+ * Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"`
405
+ */
406
+ namespace?: string
407
+ /**
408
+ * List of file names that are considered meaningless for component naming purposes.
409
+ *
410
+ * When the `fileName` option is enabled and a component is in a file with a name
411
+ * from this list, the directory name will be used instead of the file name for
412
+ * the component's display name.
413
+ *
414
+ * @default ["index"]
415
+ */
416
+ meaninglessFileNames?: Array<string>
417
+ /**
418
+ * Import paths to be considered as styled-components imports at the top level.
419
+ *
420
+ * **Note: This feature is not yet implemented in oxc.**
421
+ */
422
+ topLevelImportPaths?: Array<string>
423
+ }
424
+
342
425
  /**
343
426
  * Transpile a JavaScript or TypeScript into a target ECMAScript version.
344
427
  *
@@ -359,8 +442,8 @@ export declare function transform(filename: string, sourceText: string, options?
359
442
  * @see {@link transform}
360
443
  */
361
444
  export interface TransformOptions {
362
- /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
363
- lang?: 'js' | 'jsx' | 'ts' | 'tsx'
445
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */
446
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts'
364
447
  /** Treat the source text as `script` or `module` code. */
365
448
  sourceType?: 'script' | 'module' | 'unambiguous' | undefined
366
449
  /**
@@ -407,6 +490,8 @@ export interface TransformOptions {
407
490
  inject?: Record<string, string | [string, string]>
408
491
  /** Decorator plugin */
409
492
  decorator?: DecoratorOptions
493
+ /** Third-party plugins to use. */
494
+ plugins?: PluginsOptions
410
495
  }
411
496
 
412
497
  export interface TransformResult {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxc-transform",
3
- "version": "0.75.1",
3
+ "version": "0.77.0",
4
4
  "main": "index.js",
5
5
  "browser": "browser.js",
6
6
  "engines": {
@@ -64,24 +64,25 @@
64
64
  }
65
65
  },
66
66
  "optionalDependencies": {
67
- "@oxc-transform/binding-win32-x64-msvc": "0.75.1",
68
- "@oxc-transform/binding-win32-arm64-msvc": "0.75.1",
69
- "@oxc-transform/binding-linux-x64-gnu": "0.75.1",
70
- "@oxc-transform/binding-linux-x64-musl": "0.75.1",
71
- "@oxc-transform/binding-freebsd-x64": "0.75.1",
72
- "@oxc-transform/binding-linux-arm64-gnu": "0.75.1",
73
- "@oxc-transform/binding-linux-arm64-musl": "0.75.1",
74
- "@oxc-transform/binding-linux-arm-gnueabihf": "0.75.1",
75
- "@oxc-transform/binding-linux-arm-musleabihf": "0.75.1",
76
- "@oxc-transform/binding-linux-s390x-gnu": "0.75.1",
77
- "@oxc-transform/binding-linux-riscv64-gnu": "0.75.1",
78
- "@oxc-transform/binding-darwin-x64": "0.75.1",
79
- "@oxc-transform/binding-darwin-arm64": "0.75.1",
80
- "@oxc-transform/binding-android-arm64": "0.75.1",
81
- "@oxc-transform/binding-wasm32-wasi": "0.75.1"
67
+ "@oxc-transform/binding-win32-x64-msvc": "0.77.0",
68
+ "@oxc-transform/binding-win32-arm64-msvc": "0.77.0",
69
+ "@oxc-transform/binding-linux-x64-gnu": "0.77.0",
70
+ "@oxc-transform/binding-linux-x64-musl": "0.77.0",
71
+ "@oxc-transform/binding-freebsd-x64": "0.77.0",
72
+ "@oxc-transform/binding-linux-arm64-gnu": "0.77.0",
73
+ "@oxc-transform/binding-linux-arm64-musl": "0.77.0",
74
+ "@oxc-transform/binding-linux-arm-gnueabihf": "0.77.0",
75
+ "@oxc-transform/binding-linux-arm-musleabihf": "0.77.0",
76
+ "@oxc-transform/binding-linux-s390x-gnu": "0.77.0",
77
+ "@oxc-transform/binding-linux-riscv64-gnu": "0.77.0",
78
+ "@oxc-transform/binding-darwin-x64": "0.77.0",
79
+ "@oxc-transform/binding-darwin-arm64": "0.77.0",
80
+ "@oxc-transform/binding-android-arm64": "0.77.0",
81
+ "@oxc-transform/binding-wasm32-wasi": "0.77.0"
82
82
  },
83
83
  "scripts": {
84
84
  "build-dev": "napi build --platform",
85
+ "build-test": "pnpm run build",
85
86
  "build": "pnpm run build-dev --features allocator --release",
86
87
  "postbuild-dev": "node patch.mjs",
87
88
  "test": "tsc && vitest run --dir ./test"