File tree 11 files changed +166
-285
lines changed
packages/playground/ssr-deps
11 files changed +166
-285
lines changed Original file line number Diff line number Diff line change @@ -11,4 +11,3 @@ explorations
11
11
/packages /vite /LICENSE
12
12
* .cpuprofile
13
13
/.vscode /
14
- /packages /playground /ssr-deps /node-addon /build /
Original file line number Diff line number Diff line change @@ -8,9 +8,11 @@ const url = `http://localhost:${port}`
8
8
* NOTE: This test will always succeed now, unless the temporary workaround for Jest can be removed
9
9
* See https://github.com/vitejs/vite/pull/5197#issuecomment-938054077
10
10
*/
11
- test ( 'msg from node addon ' , async ( ) => {
11
+ test ( 'msg should be encrypted ' , async ( ) => {
12
12
await page . goto ( url )
13
- expect ( await page . textContent ( '.node-addon-msg' ) ) . toMatch ( 'Hello World!' )
13
+ expect ( await page . textContent ( '.encrypted-msg' ) ) . not . toMatch (
14
+ 'Secret Message!'
15
+ )
14
16
} )
15
17
16
18
test ( 'msg read by fs/promises' , async ( ) => {
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 9
9
"postinstall" : " node ../../../scripts/patchFileDeps.cjs"
10
10
},
11
11
"dependencies" : {
12
- "node-addon" : " link:./node-addon" ,
13
- "primitive-export" : " link:./primitive-export" ,
12
+ "bcrypt" : " ^5.0.1" ,
13
+ "forwarded-export" : " file:./forwarded-export" ,
14
+ "object-assigned-exports" : " file:./object-assigned-exports" ,
15
+ "primitive-export" : " file:./primitive-export" ,
14
16
"read-file-content" : " file:./read-file-content" ,
15
- "ts-transpiled-exports" : " link:./ts-transpiled-exports" ,
16
- "object-assigned-exports" : " link:./object-assigned-exports" ,
17
- "forwarded-export" : " link:./forwarded-export"
17
+ "ts-transpiled-exports" : " file:./ts-transpiled-exports"
18
18
},
19
19
"devDependencies" : {
20
20
"cross-env" : " ^7.0.3" ,
Original file line number Diff line number Diff line change 1
1
import path from 'path'
2
- import { hello } from 'node-addon'
3
2
import readFileContent from 'read-file-content'
4
3
import primitiveExport from 'primitive-export'
5
4
import tsDefaultExport , { hello as tsNamedExport } from 'ts-transpiled-exports'
6
5
import objectAssignedExports from 'object-assigned-exports'
7
6
import forwardedExport from 'forwarded-export'
7
+ import bcrypt from 'bcrypt'
8
8
9
9
export async function render ( url , rootDir ) {
10
10
let html = ''
11
11
12
- const nodeAddonMsg = hello ( )
13
- html += `\n<p class="node-addon- msg">message from node addon : ${ nodeAddonMsg } </p>`
12
+ const encryptedMsg = await bcrypt . hash ( 'Secret Message!' , 10 )
13
+ html += `\n<p class="encrypted- msg">encrypted message : ${ encryptedMsg } </p>`
14
14
15
15
const fileContent = await readFileContent ( path . resolve ( rootDir , 'message' ) )
16
16
html += `\n<p class="file-message">msg read via fs/promises: ${ fileContent } </p>`
Original file line number Diff line number Diff line change 2
2
* @type {import('vite').UserConfig }
3
3
*/
4
4
module . exports = {
5
- resolve : {
6
- // The dependency `node-addon` needs to be linked to node_modules and preserve symlinks,
7
- // because the `.node` file cannot be unlinked in Windows after being filed to node_modules
8
- // ref: https://github.com/nodejs/node/issues/24878/
9
- preserveSymlinks : true
5
+ ssr : {
6
+ external : [ 'object-assigned-exports' ]
10
7
}
11
8
}
You can’t perform that action at this time.
0 commit comments