Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add @farmfe/plugin-dts #1933

Open
wants to merge 5 commits into
base: v2-dev
Choose a base branch
from
Open
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
607 changes: 489 additions & 118 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions examples/lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Farm + TypeScript

This template should help you start developing using TypeScript in Farm.

## Setup

Install the dependencies:

```bash
pnpm install
```

## Get Started

Start the dev server:

```bash
pnpm start
```

Build the app for production:

```bash
pnpm build
```

Preview the Production build product:

```bash
pnpm preview
```

Clear persistent cache local files

```bash
pnpm clean
```
13 changes: 13 additions & 0 deletions examples/lib/farm.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from '@farmfe/core';

export default defineConfig({
compilation: {
presetEnv: false,
progress: false,
input: {
index: "./index.ts"
},
persistentCache: false
},
plugins: ['@farmfe/plugin-dts']
});
1 change: 1 addition & 0 deletions examples/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const a: number = 1;
15 changes: 15 additions & 0 deletions examples/lib/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "lib",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"build": "farm build",
"clean": "farm clean"
},
"devDependencies": {
"@farmfe/cli": "workspace:*",
"typescript": "^5.4.3",
"@farmfe/plugin-dts": "workspace:*"
}
}
24 changes: 24 additions & 0 deletions examples/lib/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
11 changes: 11 additions & 0 deletions examples/lib/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": ["farm.config.ts"]
}
9 changes: 5 additions & 4 deletions js-plugins/less/farm.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import farmDtsPlugin from '@farmfe/js-plugin-dts';
// import farmDtsPlugin from '@farmfe/js-plugin-dts';
import { createFarmJsPluginBuildConfig } from '../../configs/farm-js-plugin.base.config.mjs';

export default createFarmJsPluginBuildConfig([
farmDtsPlugin({
tsConfigPath: './tsconfig.build.json'
})
// farmDtsPlugin({
// tsConfigPath: './tsconfig.build.json'
// }),
// '@farmfe/plugin-dts'
]);
1 change: 1 addition & 0 deletions js-plugins/less/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@farmfe/cli": "workspace:*",
"@farmfe/core": "workspace:*",
"@farmfe/js-plugin-dts": "workspace:^",
"@farmfe/plugin-dts": "workspace:*",
"@types/less": "^3.0.3",
"less": "^4.1.3"
},
Expand Down
41 changes: 31 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions rust-plugins/dts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.farm
*.node
7 changes: 7 additions & 0 deletions rust-plugins/dts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @farmfe/plugin-replace-dirname

## 1.0.0-nightly-20241024075304

### Major Changes

- 9a1b2b9: bump replace-dirname plugin
21 changes: 21 additions & 0 deletions rust-plugins/dts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
edition = "2021"
name = "farmfe_plugin_dts"
version = "0.0.0"

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
farmfe_core = { version = "*", path = "../../crates/core" }
farmfe_macro_plugin = { version = "*", path = "../../crates/macro_plugin" }
farmfe_toolkit_plugin_types = { version = "*", path = "../../crates/toolkit_plugin_types" }
farmfe_toolkit = { version = "*", path = "../../crates/toolkit" }
regex = "1.7.3"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
url = "2.3.1"
oxc_allocator = "0.36.0"
oxc_parser = "0.36.0"
oxc_span = "0.36.0"
oxc_transformer = "0.36.0"
13 changes: 13 additions & 0 deletions rust-plugins/dts/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export interface IOptions {
/**
* The path to the root of the project
*/
include?: string[];
/**
* exclude the path from the project
*/
exclude?: string[];
}

const binPath: string;
export default binPath;
Loading
Loading