-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(hmr): refactor hmr * chore: add dispose, decline * chore: add svelet demo * chore: update config * chore: add more vite compabitabilities * chore: suppor ws server of vite server adapter * refactor: config normalize * chore: hmr protocol alignment * refactor: hmr detection * chore: detect hmr boudaries * chore: support hmr api * chore: solve conflicts * fix: test issues
- Loading branch information
Showing
126 changed files
with
2,776 additions
and
1,287 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,7 @@ | ||
--- | ||
'@farmfe/js-plugin-record-viewer': patch | ||
'@farmfe/js-plugin-less': patch | ||
'@farmfe/core': patch | ||
--- | ||
|
||
Normalize js plugin hooks name |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,46 @@ | ||
import { builtinModules } from 'module'; | ||
|
||
const format = process.env.FARM_FORMAT || 'cjs'; | ||
const ext = format === 'esm' ? 'mjs' : 'cjs'; | ||
console.log('format', format, ext); | ||
|
||
export function createFarmJsPluginBuildConfig(plugins) { | ||
return { | ||
compilation: { | ||
input: { | ||
index: './src/index.ts' | ||
}, | ||
output: { | ||
path: `build/${format}`, | ||
entryFilename: `[entryName].${ext}`, | ||
targetEnv: 'node', | ||
format | ||
}, | ||
external: [ | ||
...builtinModules.map((m) => `^${m}$`), | ||
...builtinModules.map((m) => `^node:${m}$`) | ||
], | ||
partialBundling: { | ||
enforceResources: [ | ||
{ | ||
name: 'index.js', | ||
test: ['.+'] | ||
} | ||
] | ||
}, | ||
minify: false, | ||
sourcemap: false, | ||
presetEnv: false, | ||
persistentCache: { | ||
envs: { | ||
FARM_FORMAT: format | ||
} | ||
} | ||
}, | ||
server: { | ||
hmr: false | ||
}, | ||
plugins, | ||
}; | ||
|
||
} |
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
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
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
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,3 @@ | ||
export function bar() { | ||
return 'bar'; | ||
} |
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,15 @@ | ||
import { foo } from './foo.js' | ||
import { bar } from './bar.js' | ||
|
||
foo() | ||
bar() | ||
|
||
// Can also accept an array of dep modules: | ||
import.meta.hot.accept( | ||
['./foo.js', './bar.js'], | ||
([newFooModule, newBarModule]) => { | ||
// The callback receives an array where only the updated module is | ||
// non null. If the update was not successful (syntax error for ex.), | ||
// the array is empty | ||
}, | ||
) |
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,3 @@ | ||
export function foo() { | ||
return 'foo'; | ||
} |
11 changes: 11 additions & 0 deletions
11
crates/compiler/tests/fixtures/script/accept_deps/index.ts
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,11 @@ | ||
import { foo } from './foo.js' | ||
import './dep'; | ||
|
||
foo() | ||
|
||
if (import.meta.hot) { | ||
import.meta.hot.accept('./foo.js', (newFoo) => { | ||
// the callback receives the updated './foo.js' module | ||
newFoo?.foo() | ||
}); | ||
} |
Oops, something went wrong.