-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vite): add createNodesV2 function (#26484)
- chore(vite): move single file processing of plugin to own function - feat(vite): add CreateNodesV2 function <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> ## Current Behavior <!-- This is the behavior we have today --> There is no implementation for createNodesV2 ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> There should be an implementation for createNodesV2 ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
- Loading branch information
Showing
8 changed files
with
264 additions
and
195 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export { | ||
createNodes, | ||
createNodesV2, | ||
VitePluginOptions, | ||
createDependencies, | ||
} from './src/plugins/plugin'; |
56 changes: 31 additions & 25 deletions
56
packages/vite/src/plugins/__snapshots__/plugin-vitest.spec.ts.snap
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 |
---|---|---|
@@ -1,35 +1,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`@nx/vite/plugin root project should create nodes 1`] = ` | ||
{ | ||
"projects": { | ||
".": { | ||
"root": ".", | ||
"targets": { | ||
"test": { | ||
"cache": true, | ||
"command": "vitest", | ||
"inputs": [ | ||
"default", | ||
"^production", | ||
{ | ||
"externalDependencies": [ | ||
"vitest", | ||
[ | ||
[ | ||
"vitest.config.ts", | ||
{ | ||
"projects": { | ||
".": { | ||
"metadata": {}, | ||
"root": ".", | ||
"targets": { | ||
"test": { | ||
"cache": true, | ||
"command": "vitest", | ||
"inputs": [ | ||
"default", | ||
"^production", | ||
{ | ||
"externalDependencies": [ | ||
"vitest", | ||
], | ||
}, | ||
{ | ||
"env": "CI", | ||
}, | ||
], | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
"outputs": [ | ||
"{projectRoot}/coverage", | ||
], | ||
}, | ||
{ | ||
"env": "CI", | ||
}, | ||
], | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
"outputs": [ | ||
"{projectRoot}/coverage", | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
], | ||
] | ||
`; |
56 changes: 31 additions & 25 deletions
56
packages/vite/src/plugins/__snapshots__/plugin-with-test.spec.ts.snap
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 |
---|---|---|
@@ -1,35 +1,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`@nx/vite/plugin with test node root project should create nodes - with test too 1`] = ` | ||
{ | ||
"projects": { | ||
".": { | ||
"root": ".", | ||
"targets": { | ||
"test": { | ||
"cache": true, | ||
"command": "vitest", | ||
"inputs": [ | ||
"default", | ||
"^production", | ||
{ | ||
"externalDependencies": [ | ||
"vitest", | ||
[ | ||
[ | ||
"vite.config.ts", | ||
{ | ||
"projects": { | ||
".": { | ||
"metadata": {}, | ||
"root": ".", | ||
"targets": { | ||
"test": { | ||
"cache": true, | ||
"command": "vitest", | ||
"inputs": [ | ||
"default", | ||
"^production", | ||
{ | ||
"externalDependencies": [ | ||
"vitest", | ||
], | ||
}, | ||
{ | ||
"env": "CI", | ||
}, | ||
], | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
"outputs": [ | ||
"{projectRoot}/coverage", | ||
], | ||
}, | ||
{ | ||
"env": "CI", | ||
}, | ||
], | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
"outputs": [ | ||
"{projectRoot}/coverage", | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
], | ||
] | ||
`; |
188 changes: 100 additions & 88 deletions
188
packages/vite/src/plugins/__snapshots__/plugin.spec.ts.snap
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 |
---|---|---|
@@ -1,107 +1,119 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`@nx/vite/plugin not root project should create nodes 1`] = ` | ||
{ | ||
"projects": { | ||
"my-app": { | ||
"root": "my-app", | ||
"targets": { | ||
"build-something": { | ||
"cache": true, | ||
"command": "vite build", | ||
"dependsOn": [ | ||
"^build-something", | ||
], | ||
"inputs": [ | ||
"production", | ||
"^production", | ||
{ | ||
"externalDependencies": [ | ||
"vite", | ||
[ | ||
[ | ||
"my-app/vite.config.ts", | ||
{ | ||
"projects": { | ||
"my-app": { | ||
"metadata": {}, | ||
"root": "my-app", | ||
"targets": { | ||
"build-something": { | ||
"cache": true, | ||
"command": "vite build", | ||
"dependsOn": [ | ||
"^build-something", | ||
], | ||
"inputs": [ | ||
"production", | ||
"^production", | ||
{ | ||
"externalDependencies": [ | ||
"vite", | ||
], | ||
}, | ||
], | ||
"options": { | ||
"cwd": "my-app", | ||
}, | ||
"outputs": [ | ||
"{workspaceRoot}/dist/{projectRoot}", | ||
], | ||
}, | ||
], | ||
"options": { | ||
"cwd": "my-app", | ||
}, | ||
"outputs": [ | ||
"{workspaceRoot}/dist/{projectRoot}", | ||
], | ||
}, | ||
"my-serve": { | ||
"command": "vite serve", | ||
"options": { | ||
"cwd": "my-app", | ||
}, | ||
}, | ||
"preview-site": { | ||
"command": "vite preview", | ||
"options": { | ||
"cwd": "my-app", | ||
}, | ||
}, | ||
"serve-static": { | ||
"executor": "@nx/web:file-server", | ||
"options": { | ||
"buildTarget": "build-something", | ||
"spa": true, | ||
"my-serve": { | ||
"command": "vite serve", | ||
"options": { | ||
"cwd": "my-app", | ||
}, | ||
}, | ||
"preview-site": { | ||
"command": "vite preview", | ||
"options": { | ||
"cwd": "my-app", | ||
}, | ||
}, | ||
"serve-static": { | ||
"executor": "@nx/web:file-server", | ||
"options": { | ||
"buildTarget": "build-something", | ||
"spa": true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
], | ||
] | ||
`; | ||
|
||
exports[`@nx/vite/plugin root project should create nodes 1`] = ` | ||
{ | ||
"projects": { | ||
".": { | ||
"root": ".", | ||
"targets": { | ||
"build": { | ||
"cache": true, | ||
"command": "vite build", | ||
"dependsOn": [ | ||
"^build", | ||
], | ||
"inputs": [ | ||
"production", | ||
"^production", | ||
{ | ||
"externalDependencies": [ | ||
"vite", | ||
[ | ||
[ | ||
"vite.config.ts", | ||
{ | ||
"projects": { | ||
".": { | ||
"metadata": {}, | ||
"root": ".", | ||
"targets": { | ||
"build": { | ||
"cache": true, | ||
"command": "vite build", | ||
"dependsOn": [ | ||
"^build", | ||
], | ||
"inputs": [ | ||
"production", | ||
"^production", | ||
{ | ||
"externalDependencies": [ | ||
"vite", | ||
], | ||
}, | ||
], | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
"outputs": [ | ||
"{projectRoot}/dist", | ||
], | ||
}, | ||
], | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
"outputs": [ | ||
"{projectRoot}/dist", | ||
], | ||
}, | ||
"preview": { | ||
"command": "vite preview", | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
}, | ||
"serve": { | ||
"command": "vite serve", | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
}, | ||
"serve-static": { | ||
"executor": "@nx/web:file-server", | ||
"options": { | ||
"buildTarget": "build", | ||
"spa": true, | ||
"preview": { | ||
"command": "vite preview", | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
}, | ||
"serve": { | ||
"command": "vite serve", | ||
"options": { | ||
"cwd": ".", | ||
}, | ||
}, | ||
"serve-static": { | ||
"executor": "@nx/web:file-server", | ||
"options": { | ||
"buildTarget": "build", | ||
"spa": true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
], | ||
] | ||
`; |
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
Oops, something went wrong.