-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(repo): merge main from https://github.com/nrwl/nx-labs
- Loading branch information
Showing
89 changed files
with
7,550 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["./package.json", "./generators.json", "./executors.json"], | ||
"parser": "jsonc-eslint-parser", | ||
"rules": { | ||
"@nx/nx-plugin-checks": "error" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p> | ||
|
||
<hr> | ||
|
||
# Nx: Smart, Fast and Extensible Build System | ||
|
||
Nx is a next generation build system with first class monorepo support and powerful integrations. | ||
|
||
This package is a Rspack plugin for Nx. | ||
|
||
## Getting Started | ||
|
||
Use `--preset=@nx/rspack` when creating new workspace. | ||
|
||
e.g. | ||
|
||
```bash | ||
npx create-nx-workspace@latest rspack-demo --preset=@nx/rspack | ||
``` | ||
|
||
Now, you can go into the `rspack-demo` folder and start development. | ||
|
||
```bash | ||
cd rspack-demo | ||
npm start | ||
``` | ||
|
||
You can also run lint, test, and e2e scripts for the project. | ||
|
||
```bash | ||
npm run lint | ||
npm run test | ||
npm run e2e | ||
``` | ||
|
||
## Existing workspaces | ||
|
||
You can add Rspack to any existing Nx workspace. | ||
|
||
First, install the plugin: | ||
|
||
```bash | ||
npm install --save-dev @nx/rspack | ||
``` | ||
|
||
Then, run the `rspack-project` generator: | ||
|
||
```bash | ||
npx nx g @nx/rspack:rspack-project --skipValidation | ||
``` | ||
|
||
**Note:** The `--skipValidation` option allows you to overwrite existing build targets. | ||
|
||
## Workspace libraries | ||
|
||
The `@nx/rspack` executor support importing workspace libs into the app. | ||
|
||
```bash | ||
npx nx g @nx/react:lib mylib | ||
``` | ||
|
||
Import the new library in your app. | ||
|
||
```typescript jsx | ||
// src/app/app.tsx | ||
import { Mylib } from '@rspack-demo/mylib'; | ||
|
||
// ... | ||
|
||
export default function App() { | ||
return <MyLib />; | ||
} | ||
``` | ||
|
||
Now, run the dev server again to see the new library in action. | ||
|
||
```bash | ||
npm start | ||
``` | ||
|
||
**Note:** You must restart the server if you make any changes to your library. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"$schema": "http://json-schema.org/schema", | ||
"executors": { | ||
"rspack": { | ||
"implementation": "./src/executors/rspack/rspack.impl", | ||
"schema": "./src/executors/rspack/schema.json", | ||
"description": "rspack executor" | ||
}, | ||
"dev-server": { | ||
"implementation": "./src/executors/dev-server/dev-server.impl", | ||
"schema": "./src/executors/dev-server/schema.json", | ||
"description": "dev-server executor" | ||
}, | ||
"ssr-dev-server": { | ||
"implementation": "./src/executors/ssr-dev-server/ssr-dev-server.impl", | ||
"schema": "./src/executors/ssr-dev-server/schema.json", | ||
"description": "Serve a SSR application." | ||
}, | ||
"module-federation-dev-server": { | ||
"implementation": "./src/executors/module-federation-dev-server/module-federation-dev-server.impl", | ||
"schema": "./src/executors/module-federation-dev-server/schema.json", | ||
"description": "Serve a host or remote application." | ||
}, | ||
"module-federation-ssr-dev-server": { | ||
"implementation": "./src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl", | ||
"schema": "./src/executors/module-federation-ssr-dev-server/schema.json", | ||
"description": "Serve a host application along with it's known remotes." | ||
}, | ||
"module-federation-static-server": { | ||
"implementation": "./src/executors/module-federation-static-server/module-federation-static-server.impl", | ||
"schema": "./src/executors/module-federation-static-server/schema.json", | ||
"description": "Serve a host and its remotes statically." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"$schema": "http://json-schema.org/schema", | ||
"name": "rspack", | ||
"version": "0.0.1", | ||
"generators": { | ||
"configuration": { | ||
"factory": "./src/generators/configuration/configuration", | ||
"schema": "./src/generators/configuration/schema.json", | ||
"description": "Rspack configuration generator." | ||
}, | ||
"init": { | ||
"factory": "./src/generators/init/init", | ||
"schema": "./src/generators/init/schema.json", | ||
"description": "Rspack init generator.", | ||
"hidden": true | ||
}, | ||
"preset": { | ||
"factory": "./src/generators/preset/preset", | ||
"schema": "./src/generators/preset/schema.json", | ||
"description": "React preset generator.", | ||
"hidden": true | ||
}, | ||
"application": { | ||
"factory": "./src/generators/application/application", | ||
"schema": "./src/generators/application/schema.json", | ||
"aliases": ["app"], | ||
"x-type": "application", | ||
"description": "React application generator." | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'rspack', | ||
preset: '../../jest.preset.js', | ||
globals: {}, | ||
transform: { | ||
'^.+\\.[tj]s$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
}, | ||
], | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: '../../coverage/packages/rspack', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"generators": { | ||
"update-16-0-0-add-nx-packages": { | ||
"cli": "nx", | ||
"version": "16.0.0-beta.1", | ||
"description": "Replace @nrwl/rspack with @nx/rspack", | ||
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages" | ||
} | ||
}, | ||
"packageJsonUpdates": { | ||
"16.1.3": { | ||
"version": "16.1.3-beta.0", | ||
"packages": { | ||
"@rspack/core": { | ||
"version": "~0.1.12", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/dev-server": { | ||
"version": "~0.1.12", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/plugin-minify": { | ||
"version": "~0.1.12", | ||
"alwaysAddToPackageJson": false | ||
} | ||
} | ||
}, | ||
"18.1.0": { | ||
"version": "18.1.0-beta.0", | ||
"packages": { | ||
"@rspack/core": { | ||
"version": "~0.5.6", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/dev-server": { | ||
"version": "~0.5.6", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/plugin-minify": { | ||
"version": "~0.5.6", | ||
"alwaysAddToPackageJson": false | ||
} | ||
} | ||
}, | ||
"18.1.3": { | ||
"version": "18.1.3", | ||
"packages": { | ||
"@rspack/core": { | ||
"version": "^0.6.1", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/dev-server": { | ||
"version": "^0.6.1", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/plugin-minify": { | ||
"version": "^0.6.1", | ||
"alwaysAddToPackageJson": false | ||
} | ||
} | ||
}, | ||
"19.3.0": { | ||
"version": "19.3.0-beta.0", | ||
"packages": { | ||
"@rspack/core": { | ||
"version": "^0.7.5", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/dev-server": { | ||
"version": "^0.7.5", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/plugin-minify": { | ||
"version": "^0.7.5", | ||
"alwaysAddToPackageJson": false | ||
} | ||
} | ||
}, | ||
"19.7.0": { | ||
"version": "19.7.0-beta.1", | ||
"packages": { | ||
"@rspack/core": { | ||
"version": "^1.0.0", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/dev-server": { | ||
"version": "^1.0.0", | ||
"alwaysAddToPackageJson": false | ||
}, | ||
"@rspack/plugin-react-refresh": { | ||
"version": "^1.0.0", | ||
"alwaysAddToPackageJson": false | ||
} | ||
} | ||
} | ||
}, | ||
"version": "0.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './src/utils/module-federation/public-api'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "@nx/rspack", | ||
"version": "0.0.1", | ||
"type": "commonjs", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/nrwl/nx-labs.git", | ||
"directory": "packages/rspack" | ||
}, | ||
"keywords": [ | ||
"Monorepo", | ||
"Next", | ||
"Vercel" | ||
], | ||
"author": "Jack Hsu", | ||
"license": "MIT", | ||
"homepage": "https://nx.dev", | ||
"main": "src/index.js", | ||
"generators": "./generators.json", | ||
"executors": "./executors.json", | ||
"dependencies": { | ||
"@nx/js": "^19.5.7", | ||
"@nx/devkit": "^19.5.7", | ||
"@phenomnomnominal/tsquery": "~5.0.1", | ||
"less-loader": "11.1.0", | ||
"license-webpack-plugin": "^4.0.2", | ||
"sass-loader": "^12.2.0", | ||
"stylus-loader": "^7.1.0", | ||
"postcss-loader": "^8.1.1", | ||
"@nx/eslint": "^19.5.7", | ||
"@rspack/core": "^1.0.2", | ||
"@rspack/plugin-react-refresh": "^1.0.0", | ||
"@rspack/plugin-minify": "^0.7.5", | ||
"chalk": "~4.1.0" | ||
}, | ||
"peerDependencies": { | ||
"@module-federation/enhanced": "~0.6.0", | ||
"@module-federation/node": "~2.5.10" | ||
}, | ||
"nx-migrations": { | ||
"migrations": "./migrations.json" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { createDependencies, createNodesV2 } from './src/plugins/plugin'; | ||
export type { RspackPluginOptions } from './src/plugins/plugin'; |
Oops, something went wrong.