solid-refresh 0.7.0 → 0.7.1

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/README.md CHANGED
@@ -152,7 +152,7 @@ Requires the use of [`@snowpack/plugin-babel`](https://www.npmjs.com/package/@sn
152
152
 
153
153
  In any case, your build system needs to support conditional exports and have the `development` condition set.
154
154
 
155
- > **Warning**
155
+ > [!WARNING]
156
156
  > In some standard HMR implementations, this may cause your app to reload the full page if the development environment isn't properly set!
157
157
 
158
158
  ## How it works
package/dist/babel.cjs CHANGED
@@ -876,24 +876,26 @@ function wrapContext(state, path, identifier, context) {
876
876
  }
877
877
  function setupProgram(state, path, comments) {
878
878
  let shouldSkip = false;
879
+ let isDone = false;
879
880
  if (comments) {
880
881
  for (const { value: comment } of comments) {
881
882
  if (/^\s*@refresh skip\s*$/.test(comment)) {
882
- state.processed = true;
883
+ isDone = true;
883
884
  shouldSkip = true;
884
885
  break;
885
886
  }
886
887
  if (/^\s*@refresh reload\s*$/.test(comment)) {
887
- state.processed = true;
888
+ isDone = true;
888
889
  path.pushContainer('body', getHMRDeclineCall(state, path));
889
890
  break;
890
891
  }
891
892
  }
892
893
  }
893
- captureIdentifiers(state, path);
894
894
  if (!shouldSkip && state.fixRender) {
895
+ captureIdentifiers(state, path);
895
896
  fixRenderCalls(state, path);
896
897
  }
898
+ return isDone;
897
899
  }
898
900
  function isStatementTopLevel(path) {
899
901
  let blockParent = path.scope.getBlockParent();
@@ -1000,13 +1002,11 @@ function solidRefreshPlugin() {
1000
1002
  identifiers: new Map(),
1001
1003
  namespaces: new Map(),
1002
1004
  },
1003
- processed: false,
1004
1005
  filename: context.filename,
1005
1006
  bundler: context.opts.bundler || 'standard',
1006
1007
  fixRender: (_b = context.opts.fixRender) !== null && _b !== void 0 ? _b : true,
1007
1008
  };
1008
- setupProgram(state, programPath, context.file.ast.comments);
1009
- if (state.processed) {
1009
+ if (setupProgram(state, programPath, context.file.ast.comments)) {
1010
1010
  return;
1011
1011
  }
1012
1012
  programPath.traverse({
package/dist/babel.mjs CHANGED
@@ -855,24 +855,26 @@ function wrapContext(state, path, identifier, context) {
855
855
  }
856
856
  function setupProgram(state, path, comments) {
857
857
  let shouldSkip = false;
858
+ let isDone = false;
858
859
  if (comments) {
859
860
  for (const { value: comment } of comments) {
860
861
  if (/^\s*@refresh skip\s*$/.test(comment)) {
861
- state.processed = true;
862
+ isDone = true;
862
863
  shouldSkip = true;
863
864
  break;
864
865
  }
865
866
  if (/^\s*@refresh reload\s*$/.test(comment)) {
866
- state.processed = true;
867
+ isDone = true;
867
868
  path.pushContainer('body', getHMRDeclineCall(state, path));
868
869
  break;
869
870
  }
870
871
  }
871
872
  }
872
- captureIdentifiers(state, path);
873
873
  if (!shouldSkip && state.fixRender) {
874
+ captureIdentifiers(state, path);
874
875
  fixRenderCalls(state, path);
875
876
  }
877
+ return isDone;
876
878
  }
877
879
  function isStatementTopLevel(path) {
878
880
  let blockParent = path.scope.getBlockParent();
@@ -979,13 +981,11 @@ function solidRefreshPlugin() {
979
981
  identifiers: new Map(),
980
982
  namespaces: new Map(),
981
983
  },
982
- processed: false,
983
984
  filename: context.filename,
984
985
  bundler: context.opts.bundler || 'standard',
985
986
  fixRender: (_b = context.opts.fixRender) !== null && _b !== void 0 ? _b : true,
986
987
  };
987
- setupProgram(state, programPath, context.file.ast.comments);
988
- if (state.processed) {
988
+ if (setupProgram(state, programPath, context.file.ast.comments)) {
989
989
  return;
990
990
  }
991
991
  programPath.traverse({
@@ -33,7 +33,6 @@ export interface StateContext {
33
33
  identifiers: Map<t.Identifier, ImportIdentifierSpecifier>;
34
34
  namespaces: Map<t.Identifier, ImportIdentifierSpecifier[]>;
35
35
  };
36
- processed: boolean;
37
36
  filename: string | undefined;
38
37
  bundler: RuntimeType;
39
38
  fixRender: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/babel/core/types.ts"],"names":[],"mappings":"AAAA,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AU,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,yBAAyB,EAAE,CAAC,CAAC;KAC5D,CAAC;IACF,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB"}
@@ -3,6 +3,6 @@ import type { Options } from './core/types';
3
3
  interface State extends babel.PluginPass {
4
4
  opts: Options;
5
5
  }
6
+ export type { Options };
6
7
  export default function solidRefreshPlugin(): babel.PluginObj<State>;
7
- export {};
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/babel/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAI1C,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AAmU1D,UAAU,KAAM,SAAQ,KAAK,CAAC,UAAU;IACtC,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAkDnE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/babel/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAI1C,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AAqU1D,UAAU,KAAM,SAAQ,KAAK,CAAC,UAAU;IACtC,IAAI,EAAE,OAAO,CAAC;CACf;AAED,YAAY,EAAE,OAAO,EAAE,CAAC;AAExB,MAAM,CAAC,OAAO,UAAU,kBAAkB,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAgDnE"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Universal HMR for SolidJS",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
- "version": "0.7.0",
7
+ "version": "0.7.1",
8
8
  "homepage": "https://github.com/solidjs/solid-refresh#readme",
9
9
  "repository": {
10
10
  "type": "git",