@netlify/plugin-nextjs 5.0.0-rc.6 → 5.0.0-rc.7

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
@@ -40,6 +40,8 @@ create it. These also run nightly and on release PRs.
40
40
 
41
41
  ### Integration testing
42
42
 
43
+ > **Prerequisite** Run `npm run build` before running integration tests.
44
+
43
45
  How to add new integration test scenarios to the application:
44
46
 
45
47
  1. Create a new folder under `tests/fixtures/<your-name>`
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/build/content/next-shims/telemetry-storage.cts
21
+ var telemetry_storage_exports = {};
22
+ __export(telemetry_storage_exports, {
23
+ TelemetryShim: () => TelemetryShim
24
+ });
25
+ module.exports = __toCommonJS(telemetry_storage_exports);
26
+ var TelemetryShim = class {
27
+ sessionId = "shim";
28
+ get anonymousId() {
29
+ return "shim";
30
+ }
31
+ get salt() {
32
+ return "shim";
33
+ }
34
+ setEnabled() {
35
+ return null;
36
+ }
37
+ get isEnabled() {
38
+ return false;
39
+ }
40
+ oneWayHash() {
41
+ return "shim";
42
+ }
43
+ record() {
44
+ return Promise.resolve({ isFulfilled: true, isRejected: false });
45
+ }
46
+ flush() {
47
+ return Promise.resolve(null);
48
+ }
49
+ flushDetached() {
50
+ }
51
+ };
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ TelemetryShim
55
+ });
@@ -7,7 +7,9 @@
7
7
  import {
8
8
  copyFetchContent,
9
9
  copyPrerenderedContent
10
- } from "../../esm-chunks/chunk-75UGFPYW.js";
10
+ } from "../../esm-chunks/chunk-4635LKT6.js";
11
+ import "../../esm-chunks/chunk-PDPDW32D.js";
12
+ import "../../esm-chunks/chunk-Y3K5Q6FP.js";
11
13
  import "../../esm-chunks/chunk-VZNKO4OO.js";
12
14
  import "../../esm-chunks/chunk-TYCYFZ22.js";
13
15
  import "../../esm-chunks/chunk-5JVNISGM.js";
@@ -7,9 +7,12 @@
7
7
  import {
8
8
  copyNextDependencies,
9
9
  copyNextServerCode,
10
+ getPatchesToApply,
10
11
  verifyHandlerDirStructure,
11
12
  writeTagsManifest
12
- } from "../../esm-chunks/chunk-CSTSA3JJ.js";
13
+ } from "../../esm-chunks/chunk-YSGPGDIG.js";
14
+ import "../../esm-chunks/chunk-PDPDW32D.js";
15
+ import "../../esm-chunks/chunk-Y3K5Q6FP.js";
13
16
  import "../../esm-chunks/chunk-VZNKO4OO.js";
14
17
  import "../../esm-chunks/chunk-MGPEWDDD.js";
15
18
  import "../../esm-chunks/chunk-PJG75HGC.js";
@@ -18,6 +21,7 @@ import "../../esm-chunks/chunk-5JVNISGM.js";
18
21
  export {
19
22
  copyNextDependencies,
20
23
  copyNextServerCode,
24
+ getPatchesToApply,
21
25
  verifyHandlerDirStructure,
22
26
  writeTagsManifest
23
27
  };
@@ -10,7 +10,9 @@ import {
10
10
  copyStaticExport,
11
11
  publishStaticDir,
12
12
  unpublishStaticDir
13
- } from "../../esm-chunks/chunk-WFVNEURA.js";
13
+ } from "../../esm-chunks/chunk-GV3YIJ33.js";
14
+ import "../../esm-chunks/chunk-PDPDW32D.js";
15
+ import "../../esm-chunks/chunk-Y3K5Q6FP.js";
14
16
  import "../../esm-chunks/chunk-VZNKO4OO.js";
15
17
  import "../../esm-chunks/chunk-TYCYFZ22.js";
16
18
  import "../../esm-chunks/chunk-5JVNISGM.js";
@@ -6,8 +6,10 @@
6
6
 
7
7
  import {
8
8
  createServerHandler
9
- } from "../../esm-chunks/chunk-W7XTKMHH.js";
10
- import "../../esm-chunks/chunk-CSTSA3JJ.js";
9
+ } from "../../esm-chunks/chunk-757FQQND.js";
10
+ import "../../esm-chunks/chunk-YSGPGDIG.js";
11
+ import "../../esm-chunks/chunk-PDPDW32D.js";
12
+ import "../../esm-chunks/chunk-Y3K5Q6FP.js";
11
13
  import "../../esm-chunks/chunk-VZNKO4OO.js";
12
14
  import "../../esm-chunks/chunk-3NYX5FXN.js";
13
15
  import "../../esm-chunks/chunk-MGPEWDDD.js";
@@ -4,6 +4,13 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
+ import {
8
+ wrapTracer
9
+ } from "./chunk-PDPDW32D.js";
10
+ import {
11
+ init_esm,
12
+ trace
13
+ } from "./chunk-Y3K5Q6FP.js";
7
14
  import {
8
15
  require_out
9
16
  } from "./chunk-VZNKO4OO.js";
@@ -15,10 +22,11 @@ import {
15
22
  } from "./chunk-5JVNISGM.js";
16
23
 
17
24
  // src/build/content/prerendered.ts
18
- var import_fast_glob = __toESM(require_out(), 1);
25
+ init_esm();
19
26
  import { existsSync } from "node:fs";
20
27
  import { mkdir, readFile, writeFile } from "node:fs/promises";
21
28
  import { join } from "node:path";
29
+ var import_fast_glob = __toESM(require_out(), 1);
22
30
 
23
31
  // node_modules/yocto-queue/index.js
24
32
  var Node = class {
@@ -124,6 +132,7 @@ function pLimit(concurrency) {
124
132
  }
125
133
 
126
134
  // src/build/content/prerendered.ts
135
+ var tracer = wrapTracer(trace.getTracer("Next runtime"));
127
136
  var writeCacheEntry = async (route, value, lastModified, ctx) => {
128
137
  const path = join(ctx.blobDir, await encodeBlobKey(route));
129
138
  const entry = JSON.stringify({
@@ -166,47 +175,49 @@ var buildFetchCacheValue = async (path) => ({
166
175
  ...JSON.parse(await readFile(path, "utf-8"))
167
176
  });
168
177
  var copyPrerenderedContent = async (ctx) => {
169
- try {
170
- await mkdir(ctx.blobDir, { recursive: true });
171
- const manifest = await ctx.getPrerenderManifest();
172
- const limitConcurrentPrerenderContentHandling = pLimit(10);
173
- await Promise.all(
174
- Object.entries(manifest.routes).map(
175
- ([route, meta]) => limitConcurrentPrerenderContentHandling(async () => {
176
- const lastModified = meta.initialRevalidateSeconds ? Date.now() - 31536e6 : Date.now();
177
- const key = routeToFilePath(route);
178
- let value;
179
- switch (true) {
180
- case (meta.dataRoute?.endsWith("/default.rsc") && !existsSync(join(ctx.publishDir, "server/app", `${key}.html`))):
181
- return;
182
- case meta.dataRoute?.endsWith(".json"):
183
- if (manifest.notFoundRoutes.includes(route)) {
178
+ return tracer.withActiveSpan("copyPrerenderedContent", async () => {
179
+ try {
180
+ await mkdir(ctx.blobDir, { recursive: true });
181
+ const manifest = await ctx.getPrerenderManifest();
182
+ const limitConcurrentPrerenderContentHandling = pLimit(10);
183
+ await Promise.all(
184
+ Object.entries(manifest.routes).map(
185
+ ([route, meta]) => limitConcurrentPrerenderContentHandling(async () => {
186
+ const lastModified = meta.initialRevalidateSeconds ? Date.now() - 31536e6 : Date.now();
187
+ const key = routeToFilePath(route);
188
+ let value;
189
+ switch (true) {
190
+ case (meta.dataRoute?.endsWith("/default.rsc") && !existsSync(join(ctx.publishDir, "server/app", `${key}.html`))):
184
191
  return;
185
- }
186
- value = await buildPagesCacheValue(join(ctx.publishDir, "server/pages", key));
187
- break;
188
- case meta.dataRoute?.endsWith(".rsc"):
189
- value = await buildAppCacheValue(join(ctx.publishDir, "server/app", key));
190
- break;
191
- case meta.dataRoute === null:
192
- value = await buildRouteCacheValue(join(ctx.publishDir, "server/app", key));
193
- break;
194
- default:
195
- throw new Error(`Unrecognized content: ${route}`);
196
- }
197
- await writeCacheEntry(key, value, lastModified, ctx);
198
- })
199
- )
200
- );
201
- if (existsSync(join(ctx.publishDir, `server/app/_not-found.html`))) {
202
- const lastModified = Date.now();
203
- const key = "/404";
204
- const value = await buildAppCacheValue(join(ctx.publishDir, "server/app/_not-found"));
205
- await writeCacheEntry(key, value, lastModified, ctx);
192
+ case meta.dataRoute?.endsWith(".json"):
193
+ if (manifest.notFoundRoutes.includes(route)) {
194
+ return;
195
+ }
196
+ value = await buildPagesCacheValue(join(ctx.publishDir, "server/pages", key));
197
+ break;
198
+ case meta.dataRoute?.endsWith(".rsc"):
199
+ value = await buildAppCacheValue(join(ctx.publishDir, "server/app", key));
200
+ break;
201
+ case meta.dataRoute === null:
202
+ value = await buildRouteCacheValue(join(ctx.publishDir, "server/app", key));
203
+ break;
204
+ default:
205
+ throw new Error(`Unrecognized content: ${route}`);
206
+ }
207
+ await writeCacheEntry(key, value, lastModified, ctx);
208
+ })
209
+ )
210
+ );
211
+ if (existsSync(join(ctx.publishDir, `server/app/_not-found.html`))) {
212
+ const lastModified = Date.now();
213
+ const key = "/404";
214
+ const value = await buildAppCacheValue(join(ctx.publishDir, "server/app/_not-found"));
215
+ await writeCacheEntry(key, value, lastModified, ctx);
216
+ }
217
+ } catch (error) {
218
+ ctx.failBuild("Failed assembling prerendered content for upload", error);
206
219
  }
207
- } catch (error) {
208
- ctx.failBuild("Failed assembling prerendered content for upload", error);
209
- }
220
+ });
210
221
  };
211
222
  var copyFetchContent = async (ctx) => {
212
223
  try {
@@ -9,7 +9,14 @@ import {
9
9
  copyNextServerCode,
10
10
  verifyHandlerDirStructure,
11
11
  writeTagsManifest
12
- } from "./chunk-CSTSA3JJ.js";
12
+ } from "./chunk-YSGPGDIG.js";
13
+ import {
14
+ wrapTracer
15
+ } from "./chunk-PDPDW32D.js";
16
+ import {
17
+ init_esm,
18
+ trace
19
+ } from "./chunk-Y3K5Q6FP.js";
13
20
  import {
14
21
  require_out
15
22
  } from "./chunk-VZNKO4OO.js";
@@ -21,44 +28,49 @@ import {
21
28
  } from "./chunk-5JVNISGM.js";
22
29
 
23
30
  // src/build/functions/server.ts
24
- var import_fast_glob = __toESM(require_out(), 1);
31
+ init_esm();
25
32
  import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
26
33
  import { join, relative } from "node:path";
27
34
  import { join as posixJoin } from "node:path/posix";
35
+ var import_fast_glob = __toESM(require_out(), 1);
36
+ var tracer = wrapTracer(trace.getTracer("Next runtime"));
28
37
  var copyHandlerDependencies = async (ctx) => {
29
- const promises = [];
30
- const { included_files: includedFiles = [] } = ctx.netlifyConfig.functions?.["*"] || {};
31
- if (includedFiles.length !== 0) {
32
- const resolvedFiles = await Promise.all(
33
- includedFiles.map((globPattern) => (0, import_fast_glob.glob)(globPattern, { cwd: process.cwd() }))
34
- );
35
- for (const filePath of resolvedFiles.flat()) {
38
+ await tracer.withActiveSpan("copyHandlerDependencies", async (span) => {
39
+ const promises = [];
40
+ const { included_files: includedFiles = [] } = ctx.netlifyConfig.functions?.["*"] || {};
41
+ span.setAttribute("next.includedFiles", includedFiles.join(","));
42
+ if (includedFiles.length !== 0) {
43
+ const resolvedFiles = await Promise.all(
44
+ includedFiles.map((globPattern) => (0, import_fast_glob.glob)(globPattern, { cwd: process.cwd() }))
45
+ );
46
+ for (const filePath of resolvedFiles.flat()) {
47
+ promises.push(
48
+ cp(
49
+ join(process.cwd(), filePath),
50
+ // the serverHandlerDir is aware of the dist dir.
51
+ // The distDir must not be the package path therefore we need to rely on the
52
+ // serverHandlerDir instead of the serverHandlerRootDir
53
+ // therefore we need to remove the package path from the filePath
54
+ join(ctx.serverHandlerDir, relative(ctx.relativeAppDir, filePath)),
55
+ {
56
+ recursive: true,
57
+ force: true
58
+ }
59
+ )
60
+ );
61
+ }
62
+ }
63
+ const fileList = await (0, import_fast_glob.glob)("dist/**/*", { cwd: ctx.pluginDir });
64
+ for (const filePath of fileList) {
36
65
  promises.push(
37
- cp(
38
- join(process.cwd(), filePath),
39
- // the serverHandlerDir is aware of the dist dir.
40
- // The distDir must not be the package path therefore we need to rely on the
41
- // serverHandlerDir instead of the serverHandlerRootDir
42
- // therefore we need to remove the package path from the filePath
43
- join(ctx.serverHandlerDir, relative(ctx.relativeAppDir, filePath)),
44
- {
45
- recursive: true,
46
- force: true
47
- }
48
- )
66
+ cp(join(ctx.pluginDir, filePath), join(ctx.serverHandlerDir, ".netlify", filePath), {
67
+ recursive: true,
68
+ force: true
69
+ })
49
70
  );
50
71
  }
51
- }
52
- const fileList = await (0, import_fast_glob.glob)("dist/**/*", { cwd: ctx.pluginDir });
53
- for (const filePath of fileList) {
54
- promises.push(
55
- cp(join(ctx.pluginDir, filePath), join(ctx.serverHandlerDir, ".netlify", filePath), {
56
- recursive: true,
57
- force: true
58
- })
59
- );
60
- }
61
- await Promise.all(promises);
72
+ await Promise.all(promises);
73
+ });
62
74
  };
63
75
  var writeHandlerManifest = async (ctx) => {
64
76
  await writeFile(
@@ -96,18 +108,18 @@ var writeHandlerFile = async (ctx) => {
96
108
  await writeFile(join(ctx.serverHandlerRootDir, `${SERVER_HANDLER_NAME}.mjs`), handler);
97
109
  };
98
110
  var createServerHandler = async (ctx) => {
99
- await rm(ctx.serverFunctionsDir, { recursive: true, force: true });
100
- await mkdir(join(ctx.serverHandlerDir, ".netlify"), { recursive: true });
101
- await Promise.all([
102
- copyNextServerCode(ctx),
103
- copyNextDependencies(ctx),
104
- writeTagsManifest(ctx),
105
- copyHandlerDependencies(ctx),
106
- writeHandlerManifest(ctx),
107
- writePackageMetadata(ctx),
108
- writeHandlerFile(ctx)
109
- ]);
110
- await verifyHandlerDirStructure(ctx);
111
+ await tracer.withActiveSpan("createServerHandler", async () => {
112
+ await rm(ctx.serverFunctionsDir, { recursive: true, force: true });
113
+ await mkdir(join(ctx.serverHandlerDir, ".netlify"), { recursive: true });
114
+ await copyNextServerCode(ctx);
115
+ await copyNextDependencies(ctx);
116
+ await writeTagsManifest(ctx);
117
+ await copyHandlerDependencies(ctx);
118
+ await writeHandlerManifest(ctx);
119
+ await writePackageMetadata(ctx);
120
+ await writeHandlerFile(ctx);
121
+ await verifyHandlerDirStructure(ctx);
122
+ });
111
123
  };
112
124
 
113
125
  export {
@@ -0,0 +1,110 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
7
+ import {
8
+ wrapTracer
9
+ } from "./chunk-PDPDW32D.js";
10
+ import {
11
+ init_esm,
12
+ trace
13
+ } from "./chunk-Y3K5Q6FP.js";
14
+ import {
15
+ require_out
16
+ } from "./chunk-VZNKO4OO.js";
17
+ import {
18
+ encodeBlobKey
19
+ } from "./chunk-TYCYFZ22.js";
20
+ import {
21
+ __toESM
22
+ } from "./chunk-5JVNISGM.js";
23
+
24
+ // src/build/content/static.ts
25
+ init_esm();
26
+ import { existsSync } from "node:fs";
27
+ import { cp, mkdir, rename, rm } from "node:fs/promises";
28
+ import { basename, join } from "node:path";
29
+ var import_fast_glob = __toESM(require_out(), 1);
30
+ var tracer = wrapTracer(trace.getTracer("Next runtime"));
31
+ var copyStaticContent = async (ctx) => {
32
+ return tracer.withActiveSpan("copyStaticContent", async () => {
33
+ const srcDir = join(ctx.publishDir, "server/pages");
34
+ const destDir = ctx.blobDir;
35
+ const paths = await (0, import_fast_glob.default)("**/*.+(html|json)", {
36
+ cwd: srcDir,
37
+ extglob: true
38
+ });
39
+ try {
40
+ await Promise.all(
41
+ paths.filter((path) => !paths.includes(`${path.slice(0, -5)}.json`)).map(async (path) => {
42
+ await cp(join(srcDir, path), join(destDir, await encodeBlobKey(path)), {
43
+ recursive: true,
44
+ force: true
45
+ });
46
+ })
47
+ );
48
+ } catch (error) {
49
+ ctx.failBuild("Failed assembling static pages for upload", error);
50
+ }
51
+ });
52
+ };
53
+ var copyStaticAssets = async (ctx) => {
54
+ return tracer.withActiveSpan("copyStaticAssets", async (span) => {
55
+ try {
56
+ await rm(ctx.staticDir, { recursive: true, force: true });
57
+ const { basePath } = await ctx.getRoutesManifest();
58
+ if (existsSync(ctx.resolveFromSiteDir("public"))) {
59
+ await cp(ctx.resolveFromSiteDir("public"), join(ctx.staticDir, basePath), {
60
+ recursive: true
61
+ });
62
+ }
63
+ if (existsSync(join(ctx.publishDir, "static"))) {
64
+ await cp(join(ctx.publishDir, "static"), join(ctx.staticDir, basePath, "_next/static"), {
65
+ recursive: true
66
+ });
67
+ }
68
+ } catch (error) {
69
+ span.end();
70
+ ctx.failBuild("Failed copying static assets", error);
71
+ }
72
+ });
73
+ };
74
+ var copyStaticExport = async (ctx) => {
75
+ await tracer.withActiveSpan("copyStaticExport", async () => {
76
+ try {
77
+ await rm(ctx.staticDir, { recursive: true, force: true });
78
+ await cp(ctx.resolveFromSiteDir("out"), ctx.staticDir, { recursive: true });
79
+ } catch (error) {
80
+ ctx.failBuild("Failed copying static export", error);
81
+ }
82
+ });
83
+ };
84
+ var publishStaticDir = async (ctx) => {
85
+ try {
86
+ await rm(ctx.tempPublishDir, { recursive: true, force: true });
87
+ await mkdir(basename(ctx.tempPublishDir), { recursive: true });
88
+ await rename(ctx.publishDir, ctx.tempPublishDir);
89
+ await rename(ctx.staticDir, ctx.publishDir);
90
+ } catch (error) {
91
+ ctx.failBuild("Failed publishing static content", error instanceof Error ? { error } : {});
92
+ }
93
+ };
94
+ var unpublishStaticDir = async (ctx) => {
95
+ try {
96
+ if (existsSync(ctx.tempPublishDir)) {
97
+ await rename(ctx.publishDir, ctx.staticDir);
98
+ await rename(ctx.tempPublishDir, ctx.publishDir);
99
+ }
100
+ } catch {
101
+ }
102
+ };
103
+
104
+ export {
105
+ copyStaticContent,
106
+ copyStaticAssets,
107
+ copyStaticExport,
108
+ publishStaticDir,
109
+ unpublishStaticDir
110
+ };
@@ -0,0 +1,89 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
7
+ import {
8
+ SpanStatusCode,
9
+ context,
10
+ init_esm
11
+ } from "./chunk-Y3K5Q6FP.js";
12
+
13
+ // node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.js
14
+ init_esm();
15
+ var defaultOnException = function(e, span) {
16
+ span.recordException(e);
17
+ span.setStatus({
18
+ code: SpanStatusCode.ERROR
19
+ });
20
+ };
21
+ function wrapTracer(tracer) {
22
+ return new SugaredTracer(tracer);
23
+ }
24
+ var SugaredTracer = (
25
+ /** @class */
26
+ function() {
27
+ function SugaredTracer2(tracer) {
28
+ this._tracer = tracer;
29
+ this.startSpan = tracer.startSpan.bind(this._tracer);
30
+ this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);
31
+ }
32
+ SugaredTracer2.prototype.withActiveSpan = function(name, arg2, arg3, arg4) {
33
+ var _a = massageParams(arg2, arg3, arg4), opts = _a.opts, ctx = _a.ctx, fn = _a.fn;
34
+ return this._tracer.startActiveSpan(name, opts, ctx, function(span) {
35
+ return handleFn(span, opts, fn);
36
+ });
37
+ };
38
+ SugaredTracer2.prototype.withSpan = function(name, arg2, arg3, arg4) {
39
+ var _a = massageParams(arg2, arg3, arg4), opts = _a.opts, ctx = _a.ctx, fn = _a.fn;
40
+ var span = this._tracer.startSpan(name, opts, ctx);
41
+ return handleFn(span, opts, fn);
42
+ };
43
+ return SugaredTracer2;
44
+ }()
45
+ );
46
+ function massageParams(arg, arg2, arg3) {
47
+ var opts;
48
+ var ctx;
49
+ var fn;
50
+ if (!arg2 && !arg3) {
51
+ fn = arg;
52
+ } else if (!arg3) {
53
+ opts = arg;
54
+ fn = arg2;
55
+ } else {
56
+ opts = arg;
57
+ ctx = arg2;
58
+ fn = arg3;
59
+ }
60
+ opts = opts !== null && opts !== void 0 ? opts : {};
61
+ ctx = ctx !== null && ctx !== void 0 ? ctx : context.active();
62
+ return { opts, ctx, fn };
63
+ }
64
+ function handleFn(span, opts, fn) {
65
+ var _a;
66
+ var onException = (_a = opts.onException) !== null && _a !== void 0 ? _a : defaultOnException;
67
+ var errorHandler = function(e) {
68
+ onException(e, span);
69
+ span.end();
70
+ throw e;
71
+ };
72
+ try {
73
+ var ret = fn(span);
74
+ if (typeof (ret === null || ret === void 0 ? void 0 : ret.then) === "function") {
75
+ return ret.then(function(val) {
76
+ span.end();
77
+ return val;
78
+ }, errorHandler);
79
+ }
80
+ span.end();
81
+ return ret;
82
+ } catch (e) {
83
+ throw errorHandler(e);
84
+ }
85
+ }
86
+
87
+ export {
88
+ wrapTracer
89
+ };