@windwalker-io/fusion-next 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,19 +1,19 @@
1
- Copyright (c) 2018 Simon Asika
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18
- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19
- OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2018 Simon Asika
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19
+ OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/index.cjs CHANGED
@@ -2008,6 +2008,9 @@ class ConfigBuilder {
2008
2008
  emptyOutDir: false,
2009
2009
  sourcemap: env.mode !== "production" ? "inline" : false
2010
2010
  },
2011
+ server: {
2012
+ hmr: fusionOptions.cliParams?.hmr
2013
+ },
2011
2014
  plugins: [],
2012
2015
  css: {
2013
2016
  devSourcemap: true
@@ -2031,6 +2034,7 @@ class ConfigBuilder {
2031
2034
  copyTasks = [];
2032
2035
  linkTasks = [];
2033
2036
  postBuildCallbacks = [];
2037
+ serverStopCallbacks = [];
2034
2038
  resolveIdCallbacks = [];
2035
2039
  loadCallbacks = [];
2036
2040
  // fileNameMap: Record<string, string> = {};
@@ -2178,7 +2182,7 @@ class ConfigBuilder {
2178
2182
 
2179
2183
  function getArgsAfterDoubleDashes(argv) {
2180
2184
  argv ??= process.argv;
2181
- return argv.slice(2).join(" ").split(" -- ").slice(1).join(" -- ").trim().split(" ").filter((v) => v !== "");
2185
+ return argv.join(" ").split(" -- ").slice(1).join(" -- ").trim().split(" ").filter((v) => v !== "");
2182
2186
  }
2183
2187
  function parseArgv(argv) {
2184
2188
  const app = yargs();
@@ -2201,6 +2205,10 @@ function parseArgv(argv) {
2201
2205
  type: "string",
2202
2206
  description: "Path to server file"
2203
2207
  });
2208
+ app.option("no-hmr", {
2209
+ type: "boolean",
2210
+ description: "Disable HMR for dev server"
2211
+ });
2204
2212
  app.option("verbose", {
2205
2213
  alias: "v",
2206
2214
  type: "count",
@@ -2853,8 +2861,8 @@ is not a problem with esbuild. You need to fix your environment instead.
2853
2861
  if (isFirstPacket) {
2854
2862
  isFirstPacket = false;
2855
2863
  let binaryVersion = String.fromCharCode(...bytes);
2856
- if (binaryVersion !== "0.25.9") {
2857
- throw new Error(`Cannot start service: Host version "${"0.25.9"}" does not match binary version ${quote(binaryVersion)}`);
2864
+ if (binaryVersion !== "0.25.10") {
2865
+ throw new Error(`Cannot start service: Host version "${"0.25.10"}" does not match binary version ${quote(binaryVersion)}`);
2858
2866
  }
2859
2867
  return;
2860
2868
  }
@@ -3980,7 +3988,7 @@ for your current platform.`);
3980
3988
  "node_modules",
3981
3989
  ".cache",
3982
3990
  "esbuild",
3983
- `pnpapi-${pkg.replace("/", "-")}-${"0.25.9"}-${path.basename(subpath)}`
3991
+ `pnpapi-${pkg.replace("/", "-")}-${"0.25.10"}-${path.basename(subpath)}`
3984
3992
  );
3985
3993
  if (!fs.existsSync(binTargetPath)) {
3986
3994
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
@@ -4015,7 +4023,7 @@ for your current platform.`);
4015
4023
  }
4016
4024
  }
4017
4025
  var _a;
4018
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.25.9";
4026
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.25.10";
4019
4027
  var esbuildCommandAndArgs = () => {
4020
4028
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
4021
4029
  throw new Error(
@@ -4080,7 +4088,7 @@ for your current platform.`);
4080
4088
  }
4081
4089
  }
4082
4090
  };
4083
- var version = "0.25.9";
4091
+ var version = "0.25.10";
4084
4092
  var build = (options) => ensureServiceIsRunning().build(options);
4085
4093
  var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
4086
4094
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -4183,7 +4191,7 @@ for your current platform.`);
4183
4191
  var ensureServiceIsRunning = () => {
4184
4192
  if (longLivedService) return longLivedService;
4185
4193
  let [command, args] = esbuildCommandAndArgs();
4186
- let child = child_process.spawn(command, args.concat(`--service=${"0.25.9"}`, "--ping"), {
4194
+ let child = child_process.spawn(command, args.concat(`--service=${"0.25.10"}`, "--ping"), {
4187
4195
  windowsHide: true,
4188
4196
  stdio: ["pipe", "pipe", "inherit"],
4189
4197
  cwd: defaultWD
@@ -4287,7 +4295,7 @@ for your current platform.`);
4287
4295
  esbuild: node_exports
4288
4296
  });
4289
4297
  callback(service);
4290
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.25.9"}`), {
4298
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.25.10"}`), {
4291
4299
  cwd: defaultWD,
4292
4300
  windowsHide: true,
4293
4301
  input: stdin,
@@ -4307,7 +4315,7 @@ for your current platform.`);
4307
4315
  var startWorkerThreadService = (worker_threads2) => {
4308
4316
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
4309
4317
  let worker = new worker_threads2.Worker(__filename, {
4310
- workerData: { workerPort, defaultWD, esbuildVersion: "0.25.9" },
4318
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.25.10" },
4311
4319
  transferList: [workerPort],
4312
4320
  // From node's documentation: https://nodejs.org/api/worker_threads.html
4313
4321
  //
@@ -8842,7 +8850,7 @@ function useFusion(fusionOptions = {}, tasks) {
8842
8850
  } else {
8843
8851
  params._ = originalTasks;
8844
8852
  }
8845
- params = mergeOptions(params, resolvedOptions.cliParams);
8853
+ resolvedOptions.cliParams = params = mergeOptions(params, resolvedOptions.cliParams);
8846
8854
  return [
8847
8855
  {
8848
8856
  name: "fusion",
@@ -8925,6 +8933,9 @@ function useFusion(fusionOptions = {}, tasks) {
8925
8933
  fs$1.writeFileSync(node_path.resolve(server.config.root, serverFile), url);
8926
8934
  if (!exitHandlersBound) {
8927
8935
  process.on("exit", () => {
8936
+ for (const callback of exports.builder.serverStopCallbacks) {
8937
+ callback(resolvedConfig, server);
8938
+ }
8928
8939
  if (fs$1.existsSync(serverFile)) {
8929
8940
  fs$1.rmSync(serverFile);
8930
8941
  }