async-browser-context 0.3.0 → 0.3.2

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -1
  3. package/dist/babel/async-generator-resources.d.ts +1 -1
  4. package/dist/babel/async-generator-resources.js +3 -3
  5. package/dist/babel/async-generator-resources.js.map +1 -1
  6. package/dist/babel/bind-generators.d.ts.map +1 -1
  7. package/dist/babel/bind-generators.js +4 -3
  8. package/dist/babel/bind-generators.js.map +1 -1
  9. package/dist/babel/name-coroutines.d.ts.map +1 -1
  10. package/dist/babel/name-coroutines.js +4 -3
  11. package/dist/babel/name-coroutines.js.map +1 -1
  12. package/dist/babel/preset.d.ts +6 -0
  13. package/dist/babel/preset.d.ts.map +1 -1
  14. package/dist/babel/preset.js +25 -8
  15. package/dist/babel/preset.js.map +1 -1
  16. package/dist/babel/server-code.d.ts +30 -0
  17. package/dist/babel/server-code.d.ts.map +1 -0
  18. package/dist/babel/server-code.js +109 -0
  19. package/dist/babel/server-code.js.map +1 -0
  20. package/dist/babel/skip-runtime.d.ts +2 -2
  21. package/dist/babel/skip-runtime.d.ts.map +1 -1
  22. package/dist/babel/skip-runtime.js +17 -3
  23. package/dist/babel/skip-runtime.js.map +1 -1
  24. package/dist/babel/static-members.d.ts.map +1 -1
  25. package/dist/babel/static-members.js +12 -4
  26. package/dist/babel/static-members.js.map +1 -1
  27. package/dist/patches/handler-interfaces.d.ts +1 -1
  28. package/dist/patches/handler-interfaces.d.ts.map +1 -1
  29. package/dist/patches/handler-interfaces.js +4 -3
  30. package/dist/patches/handler-interfaces.js.map +1 -1
  31. package/package.json +4 -1
  32. package/src/babel/async-generator-resources.ts +3 -3
  33. package/src/babel/bind-generators.ts +4 -3
  34. package/src/babel/name-coroutines.ts +4 -3
  35. package/src/babel/preset.ts +27 -8
  36. package/src/babel/server-code.ts +121 -0
  37. package/src/babel/skip-runtime.ts +19 -3
  38. package/src/babel/static-members.ts +12 -4
  39. package/src/patches/handler-interfaces.ts +4 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Change history
2
2
 
3
+ ## 0.3.2
4
+
5
+ This version fixes a bug, so it is a patch version.
6
+
7
+ - The Babel preset does not change the server code of React Server Components: a file or a function with the directive `"use server"`, `"use cache"` or `"use cache: <kind>"`. Next.js accepts only native async functions there. Before, the preset changed them into functions that are not async and that use `this` and `arguments`. Next.js then stopped the build, also when a Turbopack rule gave only the files of the browser to the preset. The other presets and plugins of the configuration still change this code. The Vite plugin uses the preset, so it gets the same fix.
8
+ - The guide "Build tools" recommends a Turbopack rule with `babel-loader` for Next.js. It also tells the pnpm settings with which a dependency finds the runtime, and how to make Babel do less work. CI builds the rule with a server action and a `"use cache"` function.
9
+ - The Babel configuration file for Next.js with webpack gives the default browsers of Next.js to `@babel/preset-env` in `next/babel`. Without targets, preset-env changes the async functions of a server action, and Next.js stops the build.
10
+
11
+ ## 0.3.1
12
+
13
+ This version fixes a bug, so it is a patch version.
14
+
15
+ - The event patch also reads the interfaces `HTMLCanvasElement` and `HTMLInstallElement`. In Chromium 158, `HTMLCanvasElement` has the properties `onpaint` and `onelementgeometryupdate`, and `HTMLInstallElement` has the property `onvalidationstatuschange`. Before, the patch did not change these properties, so their handlers did not get the context of the code that set them.
16
+
3
17
  ## 0.3.0
4
18
 
5
19
  This version changes some behaviors, so it is a minor version. The first section gives the changes that can affect existing code.
package/README.md CHANGED
@@ -111,7 +111,8 @@ A test in CI (`pnpm test:bundlers`) builds a page with each of these setups and
111
111
  | webpack 5, Rspack 2 | `babel-loader` with the preset. Do not exclude `node_modules`. | All |
112
112
  | Rollup 4 | `@rollup/plugin-babel` with the preset | All |
113
113
  | esbuild | A small plugin that applies the preset | All |
114
- | Next.js 16, Turbopack or webpack | `babel.config.js` with `next/babel` and the preset, and `transpilePackages` for the dependencies | All |
114
+ | Next.js 16, Turbopack | A `turbopack.rules` rule: `babel-loader` with only the preset, for the files of the browser | All |
115
+ | Next.js 16, webpack | `babel.config.js` with `next/babel` (with the browsers of Next.js as `preset-env` targets) and the preset, and `transpilePackages` for the dependencies | All |
115
116
  | SWC, esbuild, Next.js without Babel | The target ES2016: the compiler changes async functions into generators | All except rule C5 |
116
117
 
117
118
  With the target ES2016, the patch of `then` keeps the context through `await`. A generator body then gets the context of each `next()` call, and the callback hooks get no names.
@@ -8,7 +8,7 @@ import type { PluginFactory } from "./skip-runtime.js";
8
8
  * This function gives a plugin that changes the `using` declarations of each async generator
9
9
  * in `Program` enter, with the visitor of `resources`. The preset puts it after the plugin of
10
10
  * `using` declarations and before the plugin of async generators. The functions with the
11
- * directive of the runtime stay as they are.
11
+ * directive of the runtime and the server functions (server-code.ts) stay as they are.
12
12
  */
13
13
  export declare function asyncGeneratorResources(resources: PluginFactory): PluginFactory;
14
14
  //# sourceMappingURL=async-generator-resources.d.ts.map
@@ -1,4 +1,4 @@
1
- import { isRuntimeFunction } from "./runtime-calls.js";
1
+ import { isUnchangedFunction } from "./server-code.js";
2
2
  /**
3
3
  * The plugin of Babel for `using` declarations changes the blocks of an async function when it
4
4
  * visits the function in the main traversal. But the plugin of Babel for async generators
@@ -8,7 +8,7 @@ import { isRuntimeFunction } from "./runtime-calls.js";
8
8
  * This function gives a plugin that changes the `using` declarations of each async generator
9
9
  * in `Program` enter, with the visitor of `resources`. The preset puts it after the plugin of
10
10
  * `using` declarations and before the plugin of async generators. The functions with the
11
- * directive of the runtime stay as they are.
11
+ * directive of the runtime and the server functions (server-code.ts) stay as they are.
12
12
  */
13
13
  export function asyncGeneratorResources(resources) {
14
14
  return function asyncGeneratorResourcesPlugin(api, options, dirname) {
@@ -20,7 +20,7 @@ export function asyncGeneratorResources(resources) {
20
20
  Program(programPath, state) {
21
21
  programPath.traverse({
22
22
  Function(functionPath) {
23
- if (isRuntimeFunction(functionPath.node)) {
23
+ if (isUnchangedFunction(functionPath.node)) {
24
24
  functionPath.skip();
25
25
  return;
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"async-generator-resources.js","sourceRoot":"","sources":["../../src/babel/async-generator-resources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAyB;IAC7D,OAAO,SAAS,6BAA6B,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO;QAC/D,kEAAkE;QAClE,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC;QAC/D,OAAO;YACH,IAAI,EAAG,iDAAiD;YACxD,OAAO,EAAG;gBACN,OAAO,CAAC,WAAW,EAAE,KAAK;oBACtB,WAAW,CAAC,QAAQ,CAAC;wBACjB,QAAQ,CAAC,YAAuC;4BAC5C,IAAI,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gCACvC,YAAY,CAAC,IAAI,EAAE,CAAC;gCACpB,OAAO;4BACX,CAAC;4BACD,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gCACzD,0GAA0G;gCAC1G,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;4BAC1C,CAAC;wBACL,CAAC;qBACJ,EAAE,KAAK,CAAC,CAAC;gBACd,CAAC;aACJ;SACJ,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"async-generator-resources.js","sourceRoot":"","sources":["../../src/babel/async-generator-resources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAyB;IAC7D,OAAO,SAAS,6BAA6B,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO;QAC/D,kEAAkE;QAClE,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC;QAC/D,OAAO;YACH,IAAI,EAAG,iDAAiD;YACxD,OAAO,EAAG;gBACN,OAAO,CAAC,WAAW,EAAE,KAAK;oBACtB,WAAW,CAAC,QAAQ,CAAC;wBACjB,QAAQ,CAAC,YAAuC;4BAC5C,IAAI,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gCACzC,YAAY,CAAC,IAAI,EAAE,CAAC;gCACpB,OAAO;4BACX,CAAC;4BACD,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gCACzD,0GAA0G;gCAC1G,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;4BAC1C,CAAC;wBACL,CAAC;qBACJ,EAAE,KAAK,CAAC,CAAC;gBACd,CAAC;aACJ;SACJ,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"bind-generators.d.ts","sourceRoot":"","sources":["../../src/babel/bind-generators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAIvF,iCAAiC;AACjC,MAAM,WAAW,qBAAqB;IAClC,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;CAC7B;AAED,8EAA8E;AAC9E,eAAO,MAAM,YAAY,wBAAwB,CAAC;AA0HlD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAG,OAAO,EAAE,OAAO,EAAG,MAAM,GAAI,YAAY,CAAC,UAAU,CAAC,CAuChG"}
1
+ {"version":3,"file":"bind-generators.d.ts","sourceRoot":"","sources":["../../src/babel/bind-generators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAKvF,iCAAiC;AACjC,MAAM,WAAW,qBAAqB;IAClC,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;CAC7B;AAED,8EAA8E;AAC9E,eAAO,MAAM,YAAY,wBAAwB,CAAC;AA0HlD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAG,OAAO,EAAE,OAAO,EAAG,MAAM,GAAI,YAAY,CAAC,UAAU,CAAC,CAuChG"}
@@ -1,6 +1,7 @@
1
1
  import { types } from "@babel/core";
2
2
  import { addNamed } from "@babel/helper-module-imports";
3
- import { isRuntimeCallee, isRuntimeFunction } from "./runtime-calls.js";
3
+ import { isRuntimeCallee } from "./runtime-calls.js";
4
+ import { isUnchangedFunction } from "./server-code.js";
4
5
  /** The key of the file metadata that tells if the preset changed the file. */
5
6
  export const METADATA_KEY = "asyncBrowserContext";
6
7
  /**
@@ -133,8 +134,8 @@ export function bindGeneratorsPlugin(_api, options) {
133
134
  programPath.traverse({
134
135
  Function(path) {
135
136
  const node = path.node;
136
- if (isRuntimeFunction(node)) {
137
- // The native async functions of the runtime stay native (skip-runtime.ts)
137
+ if (isUnchangedFunction(node)) {
138
+ // The native async functions of the runtime and the server functions stay native (skip-runtime.ts, server-code.ts)
138
139
  path.skip();
139
140
  return;
140
141
  }
@@ -1 +1 @@
1
- {"version":3,"file":"bind-generators.js","sourceRoot":"","sources":["../../src/babel/bind-generators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqD,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQxE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAIlD;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,IAAmB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GAAI,YAAY,CAAC,UAAU,CAAC,CAsDhG"}
@@ -1,5 +1,6 @@
1
1
  import { types } from "@babel/core";
2
- import { isRuntimeCallee, isRuntimeFunction } from "./runtime-calls.js";
2
+ import { isRuntimeCallee } from "./runtime-calls.js";
3
+ import { isUnchangedFunction } from "./server-code.js";
3
4
  /** The assignment operators that give a name to an anonymous function, as in the specification (NamedEvaluation). */
4
5
  const NAMING_OPERATORS = new Set(["=", "&&=", "||=", "??="]);
5
6
  /**
@@ -192,8 +193,8 @@ export function nameCoroutinesPlugin(_api, options) {
192
193
  namesOfFile.set(state, names);
193
194
  programPath.traverse({
194
195
  Function(path) {
195
- if (isRuntimeFunction(path.node)) {
196
- // The native async functions of the runtime stay native (skip-runtime.ts)
196
+ if (isUnchangedFunction(path.node)) {
197
+ // The native async functions of the runtime and the server functions stay native (skip-runtime.ts, server-code.ts)
197
198
  path.skip();
198
199
  return;
199
200
  }
@@ -1 +1 @@
1
- {"version":3,"file":"name-coroutines.js","sourceRoot":"","sources":["../../src/babel/name-coroutines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqD,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQxE,qHAAqH;AACrH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,GAAgB,EAAE,QAAkB;IACxD,IAAI,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,GAAG,CAAC,KAAK,CAAC;IACrB,CAAC;IACD,IAAI,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,KAAK,CAAC,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AW,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,CAAC;gCACxG,OAAO;4BACX,CAAC;4BACD,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,CAAC;4BAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;4BACzF,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gCACrB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;gCACrC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;4BACpC,CAAC;wBACL,CAAC;qBACJ,CAAC,CAAC;gBACP,CAAC;aACJ;SACJ;KACJ,CAAC;AACN,CAAC"}
@@ -45,6 +45,12 @@ export declare const DEFAULT_RUNTIME = "async-browser-context/runtime";
45
45
  * 9. `@babel/plugin-transform-async-to-generator` changes each async function
46
46
  * into a generator that the `coroutine` function of the runtime operates.
47
47
  *
48
+ * The steps 2 to 9 do not change server code of React Server Components: a file or a
49
+ * function with the directive `"use server"`, `"use cache"` or
50
+ * `"use cache: <kind>"` (server-code.ts). Next.js accepts only native async
51
+ * functions there. The other presets and plugins of the configuration still
52
+ * change that code.
53
+ *
48
54
  * The preset operates with Babel 7.22 and later and with Babel 8. Put it last
49
55
  * in the `presets` list: Babel uses the presets in reverse order.
50
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/babel/preset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAWvE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,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ncGeneratorHelpersPlugin } from "./async-generator-helpers.js";
5
5
  import { asyncGeneratorResources } from "./async-generator-resources.js";
6
6
  import { bindGeneratorsPlugin } from "./bind-generators.js";
7
7
  import { nameCoroutinesPlugin } from "./name-coroutines.js";
8
+ import { withServerCodeSkipped } from "./server-code.js";
8
9
  import { skipRuntimePlugin, withRuntimeSkipped } from "./skip-runtime.js";
9
10
  import { staticMembersPlugin } from "./static-members.js";
10
11
  export { METADATA_KEY } from "./bind-generators.js";
12
+ /*
13
+ * Each plugin after the first does not change server code (server-code.ts). The preset makes these
14
+ * plugins one time, so that the cache of Babel finds the same function for each file.
15
+ */
11
16
  /** The plugin of Babel for async generators, without a change of the functions of the runtime (skip-runtime.ts). */
12
- const asyncGeneratorFunctionsOutsideRuntime = withRuntimeSkipped(asyncGeneratorFunctions);
17
+ const asyncGeneratorFunctionsOutsideRuntime = withServerCodeSkipped(withRuntimeSkipped(asyncGeneratorFunctions));
13
18
  /** The plugin of `using` declarations for async generators, before the plugin of Babel for async generators (async-generator-resources.ts). */
14
- const asyncGeneratorResourcesPlugin = asyncGeneratorResources(explicitResourceManagement);
19
+ const asyncGeneratorResourcesPlugin = withServerCodeSkipped(asyncGeneratorResources(explicitResourceManagement));
20
+ const explicitResourceManagementPlugin = withServerCodeSkipped(explicitResourceManagement);
21
+ const asyncToGeneratorPlugin = withServerCodeSkipped(asyncToGenerator);
22
+ const bindGenerators = withServerCodeSkipped(bindGeneratorsPlugin);
23
+ const nameCoroutines = withServerCodeSkipped(nameCoroutinesPlugin);
24
+ const staticMembers = withServerCodeSkipped(staticMembersPlugin);
25
+ const asyncGeneratorHelpers = withServerCodeSkipped(asyncGeneratorHelpersPlugin);
15
26
  /** The default runtime module. */
16
27
  export const DEFAULT_RUNTIME = "async-browser-context/runtime";
17
28
  /**
@@ -41,6 +52,12 @@ export const DEFAULT_RUNTIME = "async-browser-context/runtime";
41
52
  * 9. `@babel/plugin-transform-async-to-generator` changes each async function
42
53
  * into a generator that the `coroutine` function of the runtime operates.
43
54
  *
55
+ * The steps 2 to 9 do not change server code of React Server Components: a file or a
56
+ * function with the directive `"use server"`, `"use cache"` or
57
+ * `"use cache: <kind>"` (server-code.ts). Next.js accepts only native async
58
+ * functions there. The other presets and plugins of the configuration still
59
+ * change that code.
60
+ *
44
61
  * The preset operates with Babel 7.22 and later and with Babel 8. Put it last
45
62
  * in the `presets` list: Babel uses the presets in reverse order.
46
63
  */
@@ -48,19 +65,19 @@ export default function asyncBrowserContextPreset(api, options = {}) {
48
65
  api.assertVersion("^7.22.0 || ^8.0.0");
49
66
  const runtime = options.runtime ?? DEFAULT_RUNTIME;
50
67
  // Stryker disable next-line ObjectLiteral: the plugin also finds the local names that the preset gives, for example _coroutine, without the runtime
51
- const names = options.names === false ? [] : [[nameCoroutinesPlugin, { runtime }]];
68
+ const names = options.names === false ? [] : [[nameCoroutines, { runtime }]];
52
69
  // The async transform keeps an `await using` declaration, which is a SyntaxError in a generator
53
- const resources = supportsResourceManagement(api.version) ? [explicitResourceManagement, asyncGeneratorResourcesPlugin] : [];
70
+ const resources = supportsResourceManagement(api.version) ? [explicitResourceManagementPlugin, asyncGeneratorResourcesPlugin] : [];
54
71
  return {
55
72
  plugins: [
56
73
  skipRuntimePlugin,
57
- [bindGeneratorsPlugin, { runtime }],
74
+ [bindGenerators, { runtime }],
58
75
  ...names,
59
- staticMembersPlugin,
60
- [asyncGeneratorHelpersPlugin, { runtime }],
76
+ staticMembers,
77
+ [asyncGeneratorHelpers, { runtime }],
61
78
  ...resources,
62
79
  asyncGeneratorFunctionsOutsideRuntime,
63
- [asyncToGenerator, { module: runtime, method: "coroutine" }],
80
+ [asyncToGeneratorPlugin, { module: runtime, method: "coroutine" }],
64
81
  ],
65
82
  };
66
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preset.js","sourceRoot":"","sources":["../../src/babel/preset.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,MAAM,mDAAmD,CAAC;AACxF,OAAO,gBAAgB,MAA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,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IAC5F,gGAAgG;IAChG,MAAM,SAAS,GAAkB,0BAA0B,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,EAAE,6BAA6B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClJ,OAAO;QACH,OAAO,EAAG;YACN,iBAAiB;YACjB,CAAC,cAAc,EAAE,EAAE,OAAO,EAAE,CAAC;YAC7B,GAAG,KAAK;YACR,aAAa;YACb,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,CAAC;YACpC,GAAG,SAAS;YACZ,qCAAqC;YACrC,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAG,OAAO,EAAE,MAAM,EAAG,WAAW,EAAE,CAAC;SACvE;KACJ,CAAC;AACN,CAAC;AAED,kIAAkI;AAClI,MAAM,UAAU,0BAA0B,CAAC,OAA4B;IACnE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7E,OAAO,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { types, type NodePath } from "@babel/core";
2
+ import type { PluginFactory } from "./skip-runtime.js";
3
+ /**
4
+ * This function gives `true` for a directive that marks code of the server in React Server
5
+ * Components: `"use server"`, `"use cache"` and `"use cache: <kind>"`. Next.js reads the same
6
+ * three forms. A server action and a `"use cache"` function must stay native async
7
+ * functions without `this` and `arguments`. In the bundle of the browser, Next.js replaces them
8
+ * with references to the server. On the server, the native `AsyncLocalStorage` keeps the context.
9
+ */
10
+ export declare function isServerDirective(value: string): boolean;
11
+ /** This function gives `true` if `node` is a function with a server directive in its body. */
12
+ export declare function isServerFunction(node: types.Node): boolean;
13
+ /** This function gives `true` if the preset must not change `node`: a function of the runtime or a server function. */
14
+ export declare function isUnchangedFunction(node: types.Node): boolean;
15
+ /**
16
+ * This function gives `true` if `path` is server code. Server code is in a program with a
17
+ * server directive, or in a server function, or it is a server function.
18
+ */
19
+ export declare function isServerCode(path: NodePath): boolean;
20
+ /**
21
+ * This function gives a plugin that operates as `factory`, but not on server code (refer to
22
+ * `isServerCode`). Each visitor function of the plugin first examines its path.
23
+ *
24
+ * The function does not use `path.skip()`. All the plugins of a Babel pass share one
25
+ * traversal. Thus a skip also stops the other presets in that file, for example
26
+ * `@babel/preset-typescript`. The plugins of this library that start their own traversal skip
27
+ * the server functions in that traversal (`isUnchangedFunction`).
28
+ */
29
+ export declare function withServerCodeSkipped(factory: PluginFactory): PluginFactory;
30
+ //# sourceMappingURL=server-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-code.d.ts","sourceRoot":"","sources":["../../src/babel/server-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAG,MAAM,GAAI,OAAO,CAE1D;AAMD,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,IAAI,EAAG,KAAK,CAAC,IAAI,GAAI,OAAO,CAE5D;AAED,uHAAuH;AACvH,wBAAgB,mBAAmB,CAAC,IAAI,EAAG,KAAK,CAAC,IAAI,GAAI,OAAO,CAE/D;AAsBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAG,QAAQ,GAAI,OAAO,CAWtD;AAwBD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAG,aAAa,GAAI,aAAa,CAuB7E"}
@@ -0,0 +1,109 @@
1
+ import { types } from "@babel/core";
2
+ import { isRuntimeFunction } from "./runtime-calls.js";
3
+ /**
4
+ * This function gives `true` for a directive that marks code of the server in React Server
5
+ * Components: `"use server"`, `"use cache"` and `"use cache: <kind>"`. Next.js reads the same
6
+ * three forms. A server action and a `"use cache"` function must stay native async
7
+ * functions without `this` and `arguments`. In the bundle of the browser, Next.js replaces them
8
+ * with references to the server. On the server, the native `AsyncLocalStorage` keeps the context.
9
+ */
10
+ export function isServerDirective(value) {
11
+ return value === "use server" || value === "use cache" || value.startsWith("use cache: ");
12
+ }
13
+ function hasServerDirectiveIn(directives) {
14
+ return directives.some((directive) => isServerDirective(directive.value.value));
15
+ }
16
+ /** This function gives `true` if `node` is a function with a server directive in its body. */
17
+ export function isServerFunction(node) {
18
+ return types.isFunction(node) && node.body.type === "BlockStatement" && hasServerDirectiveIn(node.body.directives);
19
+ }
20
+ /** This function gives `true` if the preset must not change `node`: a function of the runtime or a server function. */
21
+ export function isUnchangedFunction(node) {
22
+ return isRuntimeFunction(node) || isServerFunction(node);
23
+ }
24
+ /** The words of a server directive. A file without them has no server code, so the check of its paths is fast. */
25
+ const SERVER_WORDS = /use (?:server|cache)/;
26
+ /** For each file, `false` if its text has no server directive. */
27
+ const mayHaveServerCode = new WeakMap();
28
+ function fileMayHaveServerCode(state) {
29
+ const file = state?.file;
30
+ if (file === undefined) {
31
+ return true;
32
+ }
33
+ let result = mayHaveServerCode.get(file);
34
+ if (result === undefined) {
35
+ // Without the text, for example after transformFromAst, the function examines the paths. Babel then gives "".
36
+ result = typeof file.code !== "string" || file.code === "" || SERVER_WORDS.test(file.code);
37
+ mayHaveServerCode.set(file, result);
38
+ }
39
+ return result;
40
+ }
41
+ /**
42
+ * This function gives `true` if `path` is server code. Server code is in a program with a
43
+ * server directive, or in a server function, or it is a server function.
44
+ */
45
+ export function isServerCode(path) {
46
+ for (let current = path; current !== null; current = current.parentPath) {
47
+ const node = current.node;
48
+ if (types.isProgram(node)) {
49
+ return hasServerDirectiveIn(node.directives);
50
+ }
51
+ if (isServerFunction(node)) {
52
+ return true;
53
+ }
54
+ }
55
+ return false;
56
+ }
57
+ /** The keys of a visitor that are not visitor functions. */
58
+ const NOT_HANDLERS = new Set(["shouldSkip", "denylist", "blacklist", "noScope", "skipKeys", "_exploded", "_verified"]);
59
+ function guarded(handler) {
60
+ if (typeof handler !== "function") {
61
+ return handler;
62
+ }
63
+ const original = handler;
64
+ return function serverCodeSkipped(path, state) {
65
+ if (fileMayHaveServerCode(state) && isServerCode(path)) {
66
+ return;
67
+ }
68
+ original.call(this, path, state);
69
+ };
70
+ }
71
+ function guardedAll(handlers) {
72
+ return Array.isArray(handlers) ? handlers.map(guarded) : guarded(handlers);
73
+ }
74
+ /**
75
+ * This function gives a plugin that operates as `factory`, but not on server code (refer to
76
+ * `isServerCode`). Each visitor function of the plugin first examines its path.
77
+ *
78
+ * The function does not use `path.skip()`. All the plugins of a Babel pass share one
79
+ * traversal. Thus a skip also stops the other presets in that file, for example
80
+ * `@babel/preset-typescript`. The plugins of this library that start their own traversal skip
81
+ * the server functions in that traversal (`isUnchangedFunction`).
82
+ */
83
+ export function withServerCodeSkipped(factory) {
84
+ return function serverCodeSkippedPlugin(api, options, dirname) {
85
+ const plugin = factory(api, options, dirname);
86
+ if (plugin.visitor === undefined) {
87
+ return plugin;
88
+ }
89
+ const visitor = {};
90
+ for (const [key, value] of Object.entries(plugin.visitor)) {
91
+ if (NOT_HANDLERS.has(key)) {
92
+ visitor[key] = value;
93
+ }
94
+ else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
95
+ const { enter, exit } = value;
96
+ visitor[key] = {
97
+ ...value,
98
+ ...(enter === undefined ? {} : { enter: guardedAll(enter) }),
99
+ ...(exit === undefined ? {} : { exit: guardedAll(exit) }),
100
+ };
101
+ }
102
+ else {
103
+ visitor[key] = guardedAll(value);
104
+ }
105
+ }
106
+ return { ...plugin, visitor: visitor };
107
+ };
108
+ }
109
+ //# sourceMappingURL=server-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-code.js","sourceRoot":"","sources":["../../src/babel/server-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAkC,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC5C,OAAO,KAAK,KAAK,YAAY,IAAI,KAAK,KAAK,WAAW,IAAI,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC9F,CAAC;AAED,SAAS,oBAAoB,CAAC,UAAuC;IACjE,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,gBAAgB,CAAC,IAAiB;IAC9C,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,IAAI,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACvH,CAAC;AAED,uHAAuH;AACvH,MAAM,UAAU,mBAAmB,CAAC,IAAiB;IACjD,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,kHAAkH;AAClH,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAE5C,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAmB,CAAC;AAEzD,SAAS,qBAAqB,CAAC,KAA8B;IACzD,MAAM,IAAI,GAAG,KA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AA8C,CAAC;gBACvE,OAAO,CAAC,GAAG,CAAC,GAAG;oBACX,GAAG,KAAK;oBACR,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC7D,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC7D,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAG,OAAgC,EAAE,CAAC;IACrE,CAAC,CAAC;AACN,CAAC"}
@@ -13,8 +13,8 @@ export type PluginFactory = (api: PluginAPI, options: object, dirname: string) =
13
13
  * The plugin of Babel for async generators changes the async generators and the `for await`
14
14
  * loops in its own traversal. It starts that traversal in its `Program` visitor. The skip of the main
15
15
  * traversal does not apply to that traversal. This function gives a plugin that operates as
16
- * `factory`. But it puts the visitor of `skipRuntimePlugin` in front of each traversal that the `Program` visitor
17
- * starts.
16
+ * `factory`. But it puts a visitor in front of each traversal that the `Program` visitor starts.
17
+ * That visitor skips the functions of the runtime and the server functions (server-code.ts).
18
18
  *
19
19
  * The function uses the traversal of the Babel that loads the plugin (`api.traverse`).
20
20
  * If the plugin has no `Program` function, it stays as it is.
@@ -1 +1 @@
1
- {"version":3,"file":"skip-runtime.d.ts","sourceRoot":"","sources":["../../src/babel/skip-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,SAAS,EAAE,YAAY,EAAE,UAAU,EAAkB,MAAM,aAAa,CAAC;AAGjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAkBvD;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAK,YAAY,CAAC,UAAU,CAAC,CAK7D;AAED,yFAAyF;AACzF,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAG,SAAS,EAAE,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,MAAM,KAAK,YAAY,CAAC,UAAU,CAAC,CAAC;AAE9G;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAG,aAAa,GAAI,aAAa,CAwB1E"}
1
+ {"version":3,"file":"skip-runtime.d.ts","sourceRoot":"","sources":["../../src/babel/skip-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,SAAS,EAAE,YAAY,EAAE,UAAU,EAAkB,MAAM,aAAa,CAAC;AAIjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAiCvD;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAK,YAAY,CAAC,UAAU,CAAC,CAK7D;AAED,yFAAyF;AACzF,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAG,SAAS,EAAE,OAAO,EAAG,MAAM,EAAE,OAAO,EAAG,MAAM,KAAK,YAAY,CAAC,UAAU,CAAC,CAAC;AAE9G;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAG,aAAa,GAAI,aAAa,CAwB1E"}
@@ -1,4 +1,5 @@
1
1
  import { isRuntimeFunction } from "./runtime-calls.js";
2
+ import { isUnchangedFunction } from "./server-code.js";
2
3
  export { RUNTIME_DIRECTIVE } from "./runtime-calls.js";
3
4
  /** This function skips a function with the directive of the runtime. */
4
5
  function skipRuntimeFunction(functionPath) {
@@ -14,6 +15,19 @@ function skipRuntimeFunction(functionPath) {
14
15
  function skipRuntimeVisitor() {
15
16
  return { Function: skipRuntimeFunction };
16
17
  }
18
+ /** This function skips a function of the runtime or a server function (server-code.ts) in the own traversal of a plugin. */
19
+ function skipUnchangedFunction(functionPath) {
20
+ if (isUnchangedFunction(functionPath.node)) {
21
+ functionPath.skip();
22
+ }
23
+ }
24
+ /**
25
+ * This function gives a new visitor for the own traversal of a plugin. It skips each function
26
+ * that the preset must not change. A skip in that traversal does not stop the other plugins.
27
+ */
28
+ function skipUnchangedVisitor() {
29
+ return { Function: skipUnchangedFunction };
30
+ }
17
31
  /**
18
32
  * The first plugin of the preset. It skips each function with the directive of the runtime
19
33
  * (runtime-calls.ts), so that the plugins of the main traversal do not change it. The plugins
@@ -30,8 +44,8 @@ export function skipRuntimePlugin() {
30
44
  * The plugin of Babel for async generators changes the async generators and the `for await`
31
45
  * loops in its own traversal. It starts that traversal in its `Program` visitor. The skip of the main
32
46
  * traversal does not apply to that traversal. This function gives a plugin that operates as
33
- * `factory`. But it puts the visitor of `skipRuntimePlugin` in front of each traversal that the `Program` visitor
34
- * starts.
47
+ * `factory`. But it puts a visitor in front of each traversal that the `Program` visitor starts.
48
+ * That visitor skips the functions of the runtime and the server functions (server-code.ts).
35
49
  *
36
50
  * The function uses the traversal of the Babel that loads the plugin (`api.traverse`).
37
51
  * If the plugin has no `Program` function, it stays as it is.
@@ -49,7 +63,7 @@ export function withRuntimeSkipped(factory) {
49
63
  const ownTraverse = path.traverse;
50
64
  // An own property of this path object hides the method of the prototype during the visitor
51
65
  path.traverse = function (inner, innerState) {
52
- Reflect.apply(ownTraverse, this, [api.traverse.visitors.merge([skipRuntimeVisitor(), inner]), innerState]);
66
+ Reflect.apply(ownTraverse, this, [api.traverse.visitors.merge([skipUnchangedVisitor(), inner]), innerState]);
53
67
  };
54
68
  try {
55
69
  Reflect.apply(program, this, [path, state]);
@@ -1 +1 @@
1
- {"version":3,"file":"skip-runtime.js","sourceRoot":"","sources":["../../src/babel/skip-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,wEAAwE;AACxE,SAAS,mBAAmB,CAAC,YAAuC;IAChE,IAAI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M,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;QACxC,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC;QAClB,CAAC;QACD,MAAM,OAAO,GAAG;YACZ,GAAG,MAAM,CAAC,OAAO;YACjB,OAAO,CAAoB,IAA8B,EAAE,KAAkB;gBACzE,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC;gBAClC,2FAA2F;gBAC3F,IAAI,CAAC,QAAQ,GAAG,UAA2B,KAAwB,EAAE,UAAqB;oBACtF,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,oBAAoB,EAAsB,EAAE,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;gBACrI,CAAyB,CAAC;gBAC1B,IAAI,CAAC;oBACD,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;gBAChD,CAAC;wBAAS,CAAC;oBACP,OAAQ,IAAgC,CAAC,QAAQ,CAAC;gBACtD,CAAC;YACL,CAAC;SACmB,CAAC;QACzB,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC;IAClC,CAAC,CAAC;AACN,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"static-members.d.ts","sourceRoot":"","sources":["../../src/babel/static-members.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAoFvF,+GAA+G;AAC/G,wBAAgB,mBAAmB,IAAK,YAAY,CAAC,UAAU,CAAC,CA+B/D"}
1
+ {"version":3,"file":"static-members.d.ts","sourceRoot":"","sources":["../../src/babel/static-members.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAsFvF,+GAA+G;AAC/G,wBAAgB,mBAAmB,IAAK,YAAY,CAAC,UAAU,CAAC,CAqC/D"}
@@ -1,5 +1,6 @@
1
1
  import { types } from "@babel/core";
2
2
  import { keyName } from "./name-coroutines.js";
3
+ import { isUnchangedFunction } from "./server-code.js";
3
4
  /**
4
5
  * `@babel/plugin-transform-async-to-generator` keeps `this` and `super` of an async arrow
5
6
  * function in the nearest function or non-static class property. It does not stop at a static
@@ -25,17 +26,18 @@ import { keyName } from "./name-coroutines.js";
25
26
  */
26
27
  /**
27
28
  * This function gives `true` if `element` is or contains an async arrow function whose `this` is the `this` of the class element.
28
- * It gives `false` for a path without a node, for example the value of `static x;`.
29
+ * It gives `false` for a path without a node, for example the value of `static x;`. A server
30
+ * function stays where it is, because the async transform does not change it (server-code.ts).
29
31
  */
30
32
  function hasAsyncArrowOfElement(element) {
31
33
  if (element.isArrowFunctionExpression() && element.node.async) {
32
- return true;
34
+ return !isUnchangedFunction(element.node);
33
35
  }
34
36
  let found = false;
35
37
  element.traverse({
36
38
  Function(path) {
37
- if (!path.isArrowFunctionExpression()) {
38
- // A function that is not an arrow function has its own this
39
+ if (!path.isArrowFunctionExpression() || isUnchangedFunction(path.node)) {
40
+ // A function that is not an arrow function has its own this, and a server function does not change
39
41
  path.skip();
40
42
  return;
41
43
  }
@@ -83,6 +85,12 @@ export function staticMembersPlugin() {
83
85
  visitor: {
84
86
  Program(programPath) {
85
87
  programPath.traverse({
88
+ Function(path) {
89
+ // The functions of the runtime and the server functions stay as they are (server-code.ts)
90
+ if (isUnchangedFunction(path.node)) {
91
+ path.skip();
92
+ }
93
+ },
86
94
  "ClassProperty|ClassPrivateProperty|ClassAccessorProperty"(path) {
87
95
  const node = path.node;
88
96
  if (node.static !== true || !hasAsyncArrowOfElement(path.get("value"))) {
@@ -1 +1 @@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8
8
  *
9
- * The list is the union of Chromium 156, Firefox 157 and WebKit 27.2 in a
9
+ * The list is the union of Chromium 158, Firefox 157 and WebKit 27.2 in a
10
10
  * secure context. It also has some interfaces of Safari, of mobile browsers
11
11
  * and of workers. The test "patches each on... property of each interface" in
12
12
  * `test/browser/c13-events.test.ts` reads all globals in each browser of the
@@ -1 +1 @@
1
- {"version":3,"file":"handler-interfaces.d.ts","sourceRoot":"","sources":["../../src/patches/handler-interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,EAAG,SAAS,MAAM,EA0BhD,CAAC"}
1
+ {"version":3,"file":"handler-interfaces.d.ts","sourceRoot":"","sources":["../../src/patches/handler-interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,EAAG,SAAS,MAAM,EA2BhD,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * the patches took 16 to 22 ms when the page loaded. With this list, they
7
7
  * take 7 to 8 ms (the medians in CHANGELOG.md, version 0.2.0).
8
8
  *
9
- * The list is the union of Chromium 156, Firefox 157 and WebKit 27.2 in a
9
+ * The list is the union of Chromium 158, Firefox 157 and WebKit 27.2 in a
10
10
  * secure context. It also has some interfaces of Safari, of mobile browsers
11
11
  * and of workers. The test "patches each on... property of each interface" in
12
12
  * `test/browser/c13-events.test.ts` reads all globals in each browser of the
@@ -20,8 +20,9 @@ export const HANDLER_INTERFACES = [
20
20
  "BluetoothRemoteGATTService", "BroadcastChannel", "CaptureController", "Clipboard", "CloseWatcher", "CookieStore",
21
21
  "CreateMonitor", "DedicatedWorkerGlobalScope", "DevicePosture", "Document", "DocumentPictureInPicture",
22
22
  "EditContext", "Element", "EventSource", "FileReader", "FontFaceSet", "GPUDevice", "HID", "HIDDevice",
23
- "HTMLBodyElement", "HTMLCameraElement", "HTMLElement", "HTMLFrameSetElement", "HTMLGeolocationElement",
24
- "HTMLMediaElement", "HTMLMicrophoneElement", "HTMLUserMediaElement", "HTMLVideoElement", "IDBDatabase",
23
+ "HTMLBodyElement", "HTMLCameraElement", "HTMLCanvasElement", "HTMLElement", "HTMLFrameSetElement",
24
+ "HTMLGeolocationElement", "HTMLInstallElement", "HTMLMediaElement", "HTMLMicrophoneElement", "HTMLUserMediaElement",
25
+ "HTMLVideoElement", "IDBDatabase",
25
26
  "IDBOpenDBRequest", "IDBRequest", "IDBTransaction", "IdleDetector", "LanguageModel", "ManagedMediaSource",
26
27
  "ManagedSourceBuffer", "MathMLElement", "MediaDevices", "MediaKeySession", "MediaQueryList", "MediaRecorder",
27
28
  "MediaSource", "MediaStream", "MediaStreamTrack", "MessagePort", "MIDIAccess", "MIDIInput", "MIDIPort",
@@ -1 +1 @@
1
- {"version":3,"file":"handler-interfaces.js","sourceRoot":"","sources":["../../src/patches/handler-interfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IAClD,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc;IAC7F,0BAA0B,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,6BAA6B;IAC/F,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,mCAAmC;IACzG,4BAA4B,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa;IACjH,eAAe,EAAE,4BAA4B,EAAE,eAAe,EAAE,UAAU,EAAE,0BAA0B;IACtG,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW;IACrG,iBAAiB,EAAE,mBAAmB,EAAE,aAAa,EAAE,qBAAqB,EAAE,wBAAwB;IACtG,kBAAkB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,aAAa;IACtG,kBAAkB,EAAE,YAAY,EAAE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BAAwB;IAClG,4BAA4B,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB;IAC3G,eAAe,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,eAAe;IACtG,mBAAmB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe;IAC7F,wBAAwB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,YAAY,EAAE,cAAc;IAC/G,yBAAyB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,iBAAiB;IACrG,0BAA0B,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc;IAC1G,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB;IAC7G,kBAAkB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,yBAAyB;IAC3F,yBAAyB,EAAE,WAAW,EAAE,QAAQ,EAAE,uBAAuB,EAAE,QAAQ,EAAE,mBAAmB;IACxG,gBAAgB,EAAE,2BAA2B,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB;IAClG,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU;CAC7E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "async-browser-context",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "AsyncLocalStorage and the TC39 AsyncContext API (Variable, Snapshot) for browsers. The context stays through await, promises, timers, events and generators. A Babel preset and a Vite plugin transform async functions. On Node.js, the package uses the native AsyncLocalStorage.",
5
5
  "license": "MIT",
6
6
  "author": "Mark Russell",
@@ -145,6 +145,7 @@
145
145
  }
146
146
  },
147
147
  "devDependencies": {
148
+ "@mark1russell7/rigor-generators": "^0.1.8",
148
149
  "@opentelemetry/api": "^1.9.1",
149
150
  "@stryker-mutator/core": "^10.0.0",
150
151
  "@swc/core": "^1.16.18",
@@ -176,6 +177,8 @@
176
177
  "site:dev": "pnpm --filter ./site dev",
177
178
  "site:build": "pnpm --filter ./site build",
178
179
  "site:data": "tsx scripts/site-data.ts",
180
+ "site:stamps": "tsx scripts/data-stamps.ts",
181
+ "mutation:run": "tsx scripts/mutation-run.ts",
179
182
  "readme:media": "tsx scripts/readme-media.ts",
180
183
  "test:bundlers": "pnpm build && tsx test/bundlers/run.ts",
181
184
  "bench:size": "tsx bench/size.ts",
@@ -1,5 +1,5 @@
1
1
  import type { NodePath, PluginObject, PluginPass, types } from "@babel/core";
2
- import { isRuntimeFunction } from "./runtime-calls.js";
2
+ import { isUnchangedFunction } from "./server-code.js";
3
3
  import type { PluginFactory } from "./skip-runtime.js";
4
4
 
5
5
  /**
@@ -11,7 +11,7 @@ import type { PluginFactory } from "./skip-runtime.js";
11
11
  * This function gives a plugin that changes the `using` declarations of each async generator
12
12
  * in `Program` enter, with the visitor of `resources`. The preset puts it after the plugin of
13
13
  * `using` declarations and before the plugin of async generators. The functions with the
14
- * directive of the runtime stay as they are.
14
+ * directive of the runtime and the server functions (server-code.ts) stay as they are.
15
15
  */
16
16
  export function asyncGeneratorResources(resources : PluginFactory) : PluginFactory {
17
17
  return function asyncGeneratorResourcesPlugin(api, options, dirname) : PluginObject<PluginPass> {
@@ -23,7 +23,7 @@ export function asyncGeneratorResources(resources : PluginFactory) : PluginFacto
23
23
  Program(programPath, state) {
24
24
  programPath.traverse({
25
25
  Function(functionPath : NodePath<types.Function>) {
26
- if (isRuntimeFunction(functionPath.node)) {
26
+ if (isUnchangedFunction(functionPath.node)) {
27
27
  functionPath.skip();
28
28
  return;
29
29
  }
@@ -1,6 +1,7 @@
1
1
  import { types, type NodePath, type PluginObject, type PluginPass } from "@babel/core";
2
2
  import { addNamed } from "@babel/helper-module-imports";
3
- import { isRuntimeCallee, isRuntimeFunction } from "./runtime-calls.js";
3
+ import { isRuntimeCallee } from "./runtime-calls.js";
4
+ import { isUnchangedFunction } from "./server-code.js";
4
5
 
5
6
  /** The options of the plugin. */
6
7
  export interface BindGeneratorsOptions {
@@ -151,8 +152,8 @@ export function bindGeneratorsPlugin(_api : unknown, options : object) : PluginO
151
152
  programPath.traverse({
152
153
  Function(path) {
153
154
  const node = path.node;
154
- if (isRuntimeFunction(node)) {
155
- // The native async functions of the runtime stay native (skip-runtime.ts)
155
+ if (isUnchangedFunction(node)) {
156
+ // The native async functions of the runtime and the server functions stay native (skip-runtime.ts, server-code.ts)
156
157
  path.skip();
157
158
  return;
158
159
  }
@@ -1,5 +1,6 @@
1
1
  import { types, type NodePath, type PluginObject, type PluginPass } from "@babel/core";
2
- import { isRuntimeCallee, isRuntimeFunction } from "./runtime-calls.js";
2
+ import { isRuntimeCallee } from "./runtime-calls.js";
3
+ import { isUnchangedFunction } from "./server-code.js";
3
4
 
4
5
  /** The options of the plugin. */
5
6
  export interface NameCoroutinesOptions {
@@ -213,8 +214,8 @@ export function nameCoroutinesPlugin(_api : unknown, options : object) : PluginO
213
214
  namesOfFile.set(state, names);
214
215
  programPath.traverse({
215
216
  Function(path) {
216
- if (isRuntimeFunction(path.node)) {
217
- // The native async functions of the runtime stay native (skip-runtime.ts)
217
+ if (isUnchangedFunction(path.node)) {
218
+ // The native async functions of the runtime and the server functions stay native (skip-runtime.ts, server-code.ts)
218
219
  path.skip();
219
220
  return;
220
221
  }
@@ -6,6 +6,7 @@ import { asyncGeneratorHelpersPlugin } from "./async-generator-helpers.js";
6
6
  import { asyncGeneratorResources } from "./async-generator-resources.js";
7
7
  import { bindGeneratorsPlugin } from "./bind-generators.js";
8
8
  import { nameCoroutinesPlugin } from "./name-coroutines.js";
9
+ import { withServerCodeSkipped } from "./server-code.js";
9
10
  import { skipRuntimePlugin, withRuntimeSkipped, type PluginFactory } from "./skip-runtime.js";
10
11
  import { staticMembersPlugin } from "./static-members.js";
11
12
 
@@ -28,11 +29,23 @@ export interface PresetOptions {
28
29
  readonly names? : boolean | undefined;
29
30
  }
30
31
 
32
+ /*
33
+ * Each plugin after the first does not change server code (server-code.ts). The preset makes these
34
+ * plugins one time, so that the cache of Babel finds the same function for each file.
35
+ */
36
+
31
37
  /** The plugin of Babel for async generators, without a change of the functions of the runtime (skip-runtime.ts). */
32
- const asyncGeneratorFunctionsOutsideRuntime = withRuntimeSkipped(asyncGeneratorFunctions as unknown as PluginFactory);
38
+ const asyncGeneratorFunctionsOutsideRuntime = withServerCodeSkipped(withRuntimeSkipped(asyncGeneratorFunctions as unknown as PluginFactory));
33
39
 
34
40
  /** The plugin of `using` declarations for async generators, before the plugin of Babel for async generators (async-generator-resources.ts). */
35
- const asyncGeneratorResourcesPlugin = asyncGeneratorResources(explicitResourceManagement as unknown as PluginFactory);
41
+ const asyncGeneratorResourcesPlugin = withServerCodeSkipped(asyncGeneratorResources(explicitResourceManagement as unknown as PluginFactory));
42
+
43
+ const explicitResourceManagementPlugin = withServerCodeSkipped(explicitResourceManagement as unknown as PluginFactory);
44
+ const asyncToGeneratorPlugin = withServerCodeSkipped(asyncToGenerator as unknown as PluginFactory);
45
+ const bindGenerators = withServerCodeSkipped(bindGeneratorsPlugin as PluginFactory);
46
+ const nameCoroutines = withServerCodeSkipped(nameCoroutinesPlugin as PluginFactory);
47
+ const staticMembers = withServerCodeSkipped(staticMembersPlugin as PluginFactory);
48
+ const asyncGeneratorHelpers = withServerCodeSkipped(asyncGeneratorHelpersPlugin as PluginFactory);
36
49
 
37
50
  /** The default runtime module. */
38
51
  export const DEFAULT_RUNTIME = "async-browser-context/runtime";
@@ -64,6 +77,12 @@ export const DEFAULT_RUNTIME = "async-browser-context/runtime";
64
77
  * 9. `@babel/plugin-transform-async-to-generator` changes each async function
65
78
  * into a generator that the `coroutine` function of the runtime operates.
66
79
  *
80
+ * The steps 2 to 9 do not change server code of React Server Components: a file or a
81
+ * function with the directive `"use server"`, `"use cache"` or
82
+ * `"use cache: <kind>"` (server-code.ts). Next.js accepts only native async
83
+ * functions there. The other presets and plugins of the configuration still
84
+ * change that code.
85
+ *
67
86
  * The preset operates with Babel 7.22 and later and with Babel 8. Put it last
68
87
  * in the `presets` list: Babel uses the presets in reverse order.
69
88
  */
@@ -71,19 +90,19 @@ export default function asyncBrowserContextPreset(api : PresetAPI, options : Pre
71
90
  api.assertVersion("^7.22.0 || ^8.0.0");
72
91
  const runtime = options.runtime ?? DEFAULT_RUNTIME;
73
92
  // Stryker disable next-line ObjectLiteral: the plugin also finds the local names that the preset gives, for example _coroutine, without the runtime
74
- const names : PluginItem[] = options.names === false ? [] : [[nameCoroutinesPlugin, { runtime }]];
93
+ const names : PluginItem[] = options.names === false ? [] : [[nameCoroutines, { runtime }]];
75
94
  // The async transform keeps an `await using` declaration, which is a SyntaxError in a generator
76
- const resources : PluginItem[] = supportsResourceManagement(api.version) ? [explicitResourceManagement, asyncGeneratorResourcesPlugin] : [];
95
+ const resources : PluginItem[] = supportsResourceManagement(api.version) ? [explicitResourceManagementPlugin, asyncGeneratorResourcesPlugin] : [];
77
96
  return {
78
97
  plugins : [
79
98
  skipRuntimePlugin,
80
- [bindGeneratorsPlugin, { runtime }],
99
+ [bindGenerators, { runtime }],
81
100
  ...names,
82
- staticMembersPlugin,
83
- [asyncGeneratorHelpersPlugin, { runtime }],
101
+ staticMembers,
102
+ [asyncGeneratorHelpers, { runtime }],
84
103
  ...resources,
85
104
  asyncGeneratorFunctionsOutsideRuntime,
86
- [asyncToGenerator, { module : runtime, method : "coroutine" }],
105
+ [asyncToGeneratorPlugin, { module : runtime, method : "coroutine" }],
87
106
  ],
88
107
  };
89
108
  }
@@ -0,0 +1,121 @@
1
+ import { types, type NodePath, type PluginPass } from "@babel/core";
2
+ import { isRuntimeFunction } from "./runtime-calls.js";
3
+ import type { PluginFactory } from "./skip-runtime.js";
4
+
5
+ /**
6
+ * This function gives `true` for a directive that marks code of the server in React Server
7
+ * Components: `"use server"`, `"use cache"` and `"use cache: <kind>"`. Next.js reads the same
8
+ * three forms. A server action and a `"use cache"` function must stay native async
9
+ * functions without `this` and `arguments`. In the bundle of the browser, Next.js replaces them
10
+ * with references to the server. On the server, the native `AsyncLocalStorage` keeps the context.
11
+ */
12
+ export function isServerDirective(value : string) : boolean {
13
+ return value === "use server" || value === "use cache" || value.startsWith("use cache: ");
14
+ }
15
+
16
+ function hasServerDirectiveIn(directives : readonly types.Directive[]) : boolean {
17
+ return directives.some((directive) => isServerDirective(directive.value.value));
18
+ }
19
+
20
+ /** This function gives `true` if `node` is a function with a server directive in its body. */
21
+ export function isServerFunction(node : types.Node) : boolean {
22
+ return types.isFunction(node) && node.body.type === "BlockStatement" && hasServerDirectiveIn(node.body.directives);
23
+ }
24
+
25
+ /** This function gives `true` if the preset must not change `node`: a function of the runtime or a server function. */
26
+ export function isUnchangedFunction(node : types.Node) : boolean {
27
+ return isRuntimeFunction(node) || isServerFunction(node);
28
+ }
29
+
30
+ /** The words of a server directive. A file without them has no server code, so the check of its paths is fast. */
31
+ const SERVER_WORDS = /use (?:server|cache)/;
32
+
33
+ /** For each file, `false` if its text has no server directive. */
34
+ const mayHaveServerCode = new WeakMap<object, boolean>();
35
+
36
+ function fileMayHaveServerCode(state : PluginPass | undefined) : boolean {
37
+ const file = state?.file as { code? : unknown } | undefined;
38
+ if (file === undefined) {
39
+ return true;
40
+ }
41
+ let result = mayHaveServerCode.get(file);
42
+ if (result === undefined) {
43
+ // Without the text, for example after transformFromAst, the function examines the paths. Babel then gives "".
44
+ result = typeof file.code !== "string" || file.code === "" || SERVER_WORDS.test(file.code);
45
+ mayHaveServerCode.set(file, result);
46
+ }
47
+ return result;
48
+ }
49
+
50
+ /**
51
+ * This function gives `true` if `path` is server code. Server code is in a program with a
52
+ * server directive, or in a server function, or it is a server function.
53
+ */
54
+ export function isServerCode(path : NodePath) : boolean {
55
+ for (let current : NodePath | null = path; current !== null; current = current.parentPath) {
56
+ const node = current.node;
57
+ if (types.isProgram(node)) {
58
+ return hasServerDirectiveIn(node.directives);
59
+ }
60
+ if (isServerFunction(node)) {
61
+ return true;
62
+ }
63
+ }
64
+ return false;
65
+ }
66
+
67
+ /** The keys of a visitor that are not visitor functions. */
68
+ const NOT_HANDLERS = new Set(["shouldSkip", "denylist", "blacklist", "noScope", "skipKeys", "_exploded", "_verified"]);
69
+
70
+ type Handler = (this : PluginPass, path : NodePath, state : PluginPass) => void;
71
+
72
+ function guarded(handler : unknown) : unknown {
73
+ if (typeof handler !== "function") {
74
+ return handler;
75
+ }
76
+ const original = handler as Handler;
77
+ return function serverCodeSkipped(this : PluginPass, path : NodePath, state : PluginPass) : void {
78
+ if (fileMayHaveServerCode(state) && isServerCode(path)) {
79
+ return;
80
+ }
81
+ original.call(this, path, state);
82
+ };
83
+ }
84
+
85
+ function guardedAll(handlers : unknown) : unknown {
86
+ return Array.isArray(handlers) ? handlers.map(guarded) : guarded(handlers);
87
+ }
88
+
89
+ /**
90
+ * This function gives a plugin that operates as `factory`, but not on server code (refer to
91
+ * `isServerCode`). Each visitor function of the plugin first examines its path.
92
+ *
93
+ * The function does not use `path.skip()`. All the plugins of a Babel pass share one
94
+ * traversal. Thus a skip also stops the other presets in that file, for example
95
+ * `@babel/preset-typescript`. The plugins of this library that start their own traversal skip
96
+ * the server functions in that traversal (`isUnchangedFunction`).
97
+ */
98
+ export function withServerCodeSkipped(factory : PluginFactory) : PluginFactory {
99
+ return function serverCodeSkippedPlugin(api, options, dirname) {
100
+ const plugin = factory(api, options, dirname);
101
+ if (plugin.visitor === undefined) {
102
+ return plugin;
103
+ }
104
+ const visitor : Record<string, unknown> = {};
105
+ for (const [key, value] of Object.entries(plugin.visitor)) {
106
+ if (NOT_HANDLERS.has(key)) {
107
+ visitor[key] = value;
108
+ } else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
109
+ const { enter, exit } = value as { enter? : unknown; exit? : unknown };
110
+ visitor[key] = {
111
+ ...value,
112
+ ...(enter === undefined ? {} : { enter : guardedAll(enter) }),
113
+ ...(exit === undefined ? {} : { exit : guardedAll(exit) }),
114
+ };
115
+ } else {
116
+ visitor[key] = guardedAll(value);
117
+ }
118
+ }
119
+ return { ...plugin, visitor : visitor as typeof plugin.visitor };
120
+ };
121
+ }
@@ -1,5 +1,6 @@
1
1
  import type { NodePath, PluginAPI, PluginObject, PluginPass, types, Visitor } from "@babel/core";
2
2
  import { isRuntimeFunction } from "./runtime-calls.js";
3
+ import { isUnchangedFunction } from "./server-code.js";
3
4
 
4
5
  export { RUNTIME_DIRECTIVE } from "./runtime-calls.js";
5
6
 
@@ -19,6 +20,21 @@ function skipRuntimeVisitor() : Visitor<PluginPass> {
19
20
  return { Function : skipRuntimeFunction };
20
21
  }
21
22
 
23
+ /** This function skips a function of the runtime or a server function (server-code.ts) in the own traversal of a plugin. */
24
+ function skipUnchangedFunction(functionPath : NodePath<types.Function>) : void {
25
+ if (isUnchangedFunction(functionPath.node)) {
26
+ functionPath.skip();
27
+ }
28
+ }
29
+
30
+ /**
31
+ * This function gives a new visitor for the own traversal of a plugin. It skips each function
32
+ * that the preset must not change. A skip in that traversal does not stop the other plugins.
33
+ */
34
+ function skipUnchangedVisitor() : Visitor<PluginPass> {
35
+ return { Function : skipUnchangedFunction };
36
+ }
37
+
22
38
  /**
23
39
  * The first plugin of the preset. It skips each function with the directive of the runtime
24
40
  * (runtime-calls.ts), so that the plugins of the main traversal do not change it. The plugins
@@ -39,8 +55,8 @@ export type PluginFactory = (api : PluginAPI, options : object, dirname : string
39
55
  * The plugin of Babel for async generators changes the async generators and the `for await`
40
56
  * loops in its own traversal. It starts that traversal in its `Program` visitor. The skip of the main
41
57
  * traversal does not apply to that traversal. This function gives a plugin that operates as
42
- * `factory`. But it puts the visitor of `skipRuntimePlugin` in front of each traversal that the `Program` visitor
43
- * starts.
58
+ * `factory`. But it puts a visitor in front of each traversal that the `Program` visitor starts.
59
+ * That visitor skips the functions of the runtime and the server functions (server-code.ts).
44
60
  *
45
61
  * The function uses the traversal of the Babel that loads the plugin (`api.traverse`).
46
62
  * If the plugin has no `Program` function, it stays as it is.
@@ -58,7 +74,7 @@ export function withRuntimeSkipped(factory : PluginFactory) : PluginFactory {
58
74
  const ownTraverse = path.traverse;
59
75
  // An own property of this path object hides the method of the prototype during the visitor
60
76
  path.traverse = function (this : NodePath, inner : Visitor<unknown>, innerState? : unknown) : void {
61
- Reflect.apply(ownTraverse, this, [api.traverse.visitors.merge([skipRuntimeVisitor() as Visitor<unknown>, inner]), innerState]);
77
+ Reflect.apply(ownTraverse, this, [api.traverse.visitors.merge([skipUnchangedVisitor() as Visitor<unknown>, inner]), innerState]);
62
78
  } as typeof path.traverse;
63
79
  try {
64
80
  Reflect.apply(program, this, [path, state]);
@@ -1,5 +1,6 @@
1
1
  import { types, type NodePath, type PluginObject, type PluginPass } from "@babel/core";
2
2
  import { keyName } from "./name-coroutines.js";
3
+ import { isUnchangedFunction } from "./server-code.js";
3
4
 
4
5
  /**
5
6
  * `@babel/plugin-transform-async-to-generator` keeps `this` and `super` of an async arrow
@@ -27,17 +28,18 @@ import { keyName } from "./name-coroutines.js";
27
28
 
28
29
  /**
29
30
  * This function gives `true` if `element` is or contains an async arrow function whose `this` is the `this` of the class element.
30
- * It gives `false` for a path without a node, for example the value of `static x;`.
31
+ * It gives `false` for a path without a node, for example the value of `static x;`. A server
32
+ * function stays where it is, because the async transform does not change it (server-code.ts).
31
33
  */
32
34
  function hasAsyncArrowOfElement(element : NodePath) : boolean {
33
35
  if (element.isArrowFunctionExpression() && element.node.async) {
34
- return true;
36
+ return !isUnchangedFunction(element.node);
35
37
  }
36
38
  let found = false;
37
39
  element.traverse({
38
40
  Function(path) {
39
- if (!path.isArrowFunctionExpression()) {
40
- // A function that is not an arrow function has its own this
41
+ if (!path.isArrowFunctionExpression() || isUnchangedFunction(path.node)) {
42
+ // A function that is not an arrow function has its own this, and a server function does not change
41
43
  path.skip();
42
44
  return;
43
45
  }
@@ -89,6 +91,12 @@ export function staticMembersPlugin() : PluginObject<PluginPass> {
89
91
  visitor : {
90
92
  Program(programPath) {
91
93
  programPath.traverse({
94
+ Function(path) {
95
+ // The functions of the runtime and the server functions stay as they are (server-code.ts)
96
+ if (isUnchangedFunction(path.node)) {
97
+ path.skip();
98
+ }
99
+ },
92
100
  "ClassProperty|ClassPrivateProperty|ClassAccessorProperty"(path : NodePath<types.ClassProperty | types.ClassPrivateProperty | types.ClassAccessorProperty>) {
93
101
  const node = path.node;
94
102
  if (node.static !== true || !hasAsyncArrowOfElement(path.get("value") as NodePath)) {
@@ -6,7 +6,7 @@
6
6
  * the patches took 16 to 22 ms when the page loaded. With this list, they
7
7
  * take 7 to 8 ms (the medians in CHANGELOG.md, version 0.2.0).
8
8
  *
9
- * The list is the union of Chromium 156, Firefox 157 and WebKit 27.2 in a
9
+ * The list is the union of Chromium 158, Firefox 157 and WebKit 27.2 in a
10
10
  * secure context. It also has some interfaces of Safari, of mobile browsers
11
11
  * and of workers. The test "patches each on... property of each interface" in
12
12
  * `test/browser/c13-events.test.ts` reads all globals in each browser of the
@@ -20,8 +20,9 @@ export const HANDLER_INTERFACES : readonly string[] = [
20
20
  "BluetoothRemoteGATTService", "BroadcastChannel", "CaptureController", "Clipboard", "CloseWatcher", "CookieStore",
21
21
  "CreateMonitor", "DedicatedWorkerGlobalScope", "DevicePosture", "Document", "DocumentPictureInPicture",
22
22
  "EditContext", "Element", "EventSource", "FileReader", "FontFaceSet", "GPUDevice", "HID", "HIDDevice",
23
- "HTMLBodyElement", "HTMLCameraElement", "HTMLElement", "HTMLFrameSetElement", "HTMLGeolocationElement",
24
- "HTMLMediaElement", "HTMLMicrophoneElement", "HTMLUserMediaElement", "HTMLVideoElement", "IDBDatabase",
23
+ "HTMLBodyElement", "HTMLCameraElement", "HTMLCanvasElement", "HTMLElement", "HTMLFrameSetElement",
24
+ "HTMLGeolocationElement", "HTMLInstallElement", "HTMLMediaElement", "HTMLMicrophoneElement", "HTMLUserMediaElement",
25
+ "HTMLVideoElement", "IDBDatabase",
25
26
  "IDBOpenDBRequest", "IDBRequest", "IDBTransaction", "IdleDetector", "LanguageModel", "ManagedMediaSource",
26
27
  "ManagedSourceBuffer", "MathMLElement", "MediaDevices", "MediaKeySession", "MediaQueryList", "MediaRecorder",
27
28
  "MediaSource", "MediaStream", "MediaStreamTrack", "MessagePort", "MIDIAccess", "MIDIInput", "MIDIPort",