Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/docs/guide/usage/minifier/dead-code-elimination.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const bar = window.bar();
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
dropConsole: true,
},
Expand Down Expand Up @@ -55,7 +55,7 @@ debugger;
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
dropDebugger: true,
},
Expand All @@ -79,7 +79,7 @@ console.log("bar");
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
dropLabels: ["DEV"],
},
Expand All @@ -103,7 +103,7 @@ All unused function / class / variable declarations are removed by default. You
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
unused: true, // or "keep_assign"
},
Expand All @@ -128,7 +128,7 @@ var bar = function foo() {};
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
keepNames: true, // shorthand of { function: true, class: true }
},
Expand Down Expand Up @@ -219,7 +219,7 @@ bar();
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
treeshake: {
manualPureFunctions: ["foo", "bar.baz"],
Expand Down
6 changes: 3 additions & 3 deletions src/docs/guide/usage/minifier/mangling.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var e = 1;
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
module: false, // non-module code
compress: {
mangle: {
Expand All @@ -46,7 +46,7 @@ var foo = function() {};
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
mangle: {
keepNames: true, // shorthand of { function: true, class: true }
Expand Down Expand Up @@ -77,7 +77,7 @@ var slot_0 = 1;
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
mangle: {
debug: true,
Expand Down
6 changes: 3 additions & 3 deletions src/docs/guide/usage/minifier/syntax-normalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Oxc minifier uses some syntaxes that are only supported in newer environments. Y
```js
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
target: "chrome87",
},
Expand All @@ -35,7 +35,7 @@ var foo = 1, bar = 2;
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
joinVars: false,
},
Expand All @@ -59,7 +59,7 @@ foo(), bar();
// Example
import { minify } from "oxc-minify";

const result = minify("lib.js", code, {
const result = await minify("lib.js", code, {
compress: {
sequences: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const foo = 1;
// Example
import { transform } from "oxc-transform";

const result = transform("lib.js", sourceCode, {
const result = await transform("lib.js", sourceCode, {
define: {
__DEV__: "true",
},
Expand Down Expand Up @@ -50,7 +50,7 @@ console.log(foo.bar); // undefined
// Example
import { transform } from "oxc-transform";

const result = transform("lib.js", sourceCode, {
const result = await transform("lib.js", sourceCode, {
define: {
__OBJECT__: "{}",
},
Expand All @@ -76,7 +76,7 @@ const foo = new P((resolve) => resolve(1));
// Example
import { transform } from "oxc-transform";

const result = transform("lib.js", sourceCode, {
const result = await transform("lib.js", sourceCode, {
inject: {
P: ["es6-promise", "Promise"],
},
Expand Down
2 changes: 1 addition & 1 deletion src/docs/guide/usage/transformer/isolated-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export declare enum Bar {
```ts
import { isolatedDeclaration } from "oxc-transform";

const result = isolatedDeclaration("lib.ts", sourceCode, {
const result = await isolatedDeclaration("lib.ts", sourceCode, {
sourcemap: false,
stripInternal: false,
});
Expand Down
4 changes: 2 additions & 2 deletions src/docs/guide/usage/transformer/jsx.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Oxc transformer supports transforming JSX.
```js
import { transform } from "oxc-transform";

const result = transform("App.jsx", sourceCode, {
const result = await transform("App.jsx", sourceCode, {
jsx: {
runtime: "automatic", // or "classic"
development: false, // or true
Expand Down Expand Up @@ -93,7 +93,7 @@ To enable React Refresh transformation, set `jsx.refresh` option:
```javascript
import { transform } from "oxc-transform";

const result = transform("App.jsx", sourceCode, {
const result = await transform("App.jsx", sourceCode, {
jsx: {
development: true,
refresh: true,
Expand Down
4 changes: 2 additions & 2 deletions src/docs/guide/usage/transformer/lowering.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The values that are supported by [esbuild's target option](https://esbuild.githu
```js
import { transform } from "oxc-transform";

const result = transform("lib.js", "const foo = a ?? b;", {
const result = await transform("lib.js", "const foo = a ?? b;", {
target: ["chrome87", "es2022"],
});
```
Expand Down Expand Up @@ -108,7 +108,7 @@ You can specify assumptions for the compiler to make the output more smaller.
```js
import { transform } from "oxc-transform";

const result = transform("lib.js", "const foo = a ?? b;", {
const result = await transform("lib.js", "const foo = a ?? b;", {
target: ["chrome87", "es2022"],
assumptions: {
noDocumentAll: true,
Expand Down
2 changes: 1 addition & 1 deletion src/docs/guide/usage/transformer/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The styled-components plugin adds comprehensive support for styled-components wi
```javascript
import { transform } from "oxc-transform";

const result = transform("Component.jsx", sourceCode, {
const result = await transform("Component.jsx", sourceCode, {
plugins: {
styledComponents: {
displayName: true,
Expand Down
10 changes: 5 additions & 5 deletions src/docs/guide/usage/transformer/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Oxc transformer supports transforming TypeScript to JavaScript.
```js
import { transform } from "oxc-transform";

const result = transform("lib.ts", sourceCode, {
const result = await transform("lib.ts", sourceCode, {
typescript: {
jsxPragma: "React.createElement",
jsxPragmaFrag: "React.Fragment",
Expand All @@ -27,7 +27,7 @@ If you are using this option, make sure to set `typescript.onlyRemoveTypeImports
```js
import { transform } from "oxc-transform";

const result = transform("lib.ts", sourceCode, {
const result = await transform("lib.ts", sourceCode, {
typescript: {
onlyRemoveTypeImports: true,
},
Expand All @@ -43,7 +43,7 @@ If you are disabling this option, make sure to set `typescript.removeClassFields
```js
import { transform } from "oxc-transform";

const result = transform("lib.ts", sourceCode, {
const result = await transform("lib.ts", sourceCode, {
typescript: {
removeClassFieldsWithoutInitializer: true,
},
Expand All @@ -63,7 +63,7 @@ If you are using the [`emitDecoratorMetadata`](https://www.typescriptlang.org/ts
```js
import { transform } from "oxc-transform";

const result = transform("lib.ts", sourceCode, {
const result = await transform("lib.ts", sourceCode, {
decorators: {
legacy: true,
emitDecoratorMetadata: true,
Expand Down Expand Up @@ -160,7 +160,7 @@ If you are using the [`rewriteImportExtensions`](https://www.typescriptlang.org/
```js
import { transform } from "oxc-transform";

const result = transform("lib.ts", sourceCode, {
const result = await transform("lib.ts", sourceCode, {
typescript: {
rewriteImportExtensions: "rewrite", // or "remove"
},
Expand Down