@netlify/edge-bundler 10.1.2 → 10.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.
@@ -6,5 +6,6 @@ export type { EdgeFunction } from './edge_function.js';
6
6
  export { findFunctions as find } from './finder.js';
7
7
  export { generateManifest } from './manifest.js';
8
8
  export type { EdgeFunctionConfig, Manifest } from './manifest.js';
9
- export { ModuleGraph, serve } from './server/server.js';
9
+ export type { ModuleGraphJson as ModuleGraph } from './vendor/module_graph/module_graph.js';
10
+ export { serve } from './server/server.js';
10
11
  export { validateManifest, ManifestValidationError } from './validation/manifest/index.js';
@@ -3,14 +3,13 @@
3
3
  /// <reference types="node" />
4
4
  /// <reference types="node" />
5
5
  /// <reference types="node" />
6
- import type { ModuleGraphJson } from '../../deno/vendor/deno.land/x/deno_graph@0.59.2/types.d.js';
7
6
  import { OnAfterDownloadHook, OnBeforeDownloadHook } from '../bridge.js';
8
7
  import { FunctionConfig } from '../config.js';
9
8
  import type { EdgeFunction } from '../edge_function.js';
10
9
  import type { FeatureFlags } from '../feature_flags.js';
11
10
  import { LogFunction } from '../logger.js';
11
+ import type { ModuleGraphJson } from '../vendor/module_graph/module_graph.js';
12
12
  export type FormatFunction = (name: string) => string;
13
- export type ModuleGraph = ModuleGraphJson;
14
13
  interface StartServerOptions {
15
14
  getFunctionsConfig?: boolean;
16
15
  }
@@ -0,0 +1,158 @@
1
+ import type { MediaType } from "./media_type.ts";
2
+ /** Additional meta data that is used to enrich the output of the module
3
+ * graph. */
4
+ export interface CacheInfo {
5
+ /** The string path to where the local version of the content is located. For
6
+ * non `file:` URLs, this is the location of the cached content, otherwise it
7
+ * is the absolute path to the local file. */
8
+ local?: string;
9
+ /** The string path to where a transpiled version of the source content is
10
+ * located, if any. */
11
+ emit?: string;
12
+ /** The string path to where an external source map of the transpiled source
13
+ * content is located, if any. */
14
+ map?: string;
15
+ }
16
+ export interface TypesDependency {
17
+ /** The string URL to the type information for the module. */
18
+ types: string;
19
+ /** An optional range which indicates the source of the dependency. */
20
+ source?: Range;
21
+ }
22
+ export interface LoadResponseModule {
23
+ /** A module with code has been loaded. */
24
+ kind: "module";
25
+ /** The string URL of the resource. If there were redirects, the final
26
+ * specifier should be set here, otherwise the requested specifier. */
27
+ specifier: string;
28
+ /** For remote resources, a record of headers should be set, where the key's
29
+ * have been normalized to be lower case values. */
30
+ headers?: Record<string, string>;
31
+ /** The string value of the loaded resources. */
32
+ content: string;
33
+ }
34
+ export interface LoadResponseExternal {
35
+ /** The loaded module is either _external_ or _built-in_ to the runtime. */
36
+ kind: "external";
37
+ /** The strung URL of the resource. If there were redirects, the final
38
+ * specifier should be set here, otherwise the requested specifier. */
39
+ specifier: string;
40
+ }
41
+ export type LoadResponse = LoadResponseModule | LoadResponseExternal;
42
+ export interface PositionJson {
43
+ /** The line number of a position within a source file. The number is a zero
44
+ * based index. */
45
+ line: number;
46
+ /** The character number of a position within a source file. The number is a
47
+ * zero based index. */
48
+ character: number;
49
+ }
50
+ export interface Range {
51
+ /** A string URL representing a source of a dependency. */
52
+ specifier: string;
53
+ /** The start location of a range of text in a source file. */
54
+ start?: PositionJson;
55
+ /** The end location of a range of text in a source file. */
56
+ end?: PositionJson;
57
+ }
58
+ export interface RangeJson {
59
+ /** The start location of a range of text in a source file. */
60
+ start: PositionJson;
61
+ /** The end location of a range of text in a source file. */
62
+ end: PositionJson;
63
+ }
64
+ export interface ResolvedDependency {
65
+ /** The fully resolved string URL of the dependency, which should be
66
+ * resolvable in the module graph. If there was an error, `error` will be set
67
+ * and this will be undefined. */
68
+ specifier?: string;
69
+ /** Any error encountered when trying to resolved the specifier. If this is
70
+ * defined, `specifier` will be undefined. */
71
+ error?: string;
72
+ /** The range within the source code where the specifier was identified. */
73
+ span: RangeJson;
74
+ }
75
+ export interface TypesDependencyJson {
76
+ /** The string specifier that was used for the dependency. */
77
+ specifier: string;
78
+ /** An object pointing to the resolved dependency. */
79
+ dependency: ResolvedDependency;
80
+ }
81
+ /** The kind of module.
82
+ *
83
+ * For asserted modules, the value of the `asserted` property is set to the
84
+ * `type` value of the import attribute.
85
+ *
86
+ * Dependency analysis is not performed for asserted or Script modules
87
+ * currently. Synthetic modules were injected into the graph with their own
88
+ * dependencies provided. */
89
+ export type ModuleKind = "asserted" | "esm" | "npm" | "external";
90
+ export interface DependencyJson {
91
+ /** The string specifier that was used for the dependency. */
92
+ specifier: string;
93
+ /** An object pointing to the resolved _code_ dependency. */
94
+ code?: ResolvedDependency;
95
+ /** An object pointing to the resolved _type_ dependency of a module. This is
96
+ * populated when the `@deno-types` directive was used to supply a type
97
+ * definition file for a dependency. */
98
+ type?: ResolvedDependency;
99
+ /** A flag indicating if the dependency was dynamic. (e.g.
100
+ * `await import("mod.ts")`) */
101
+ isDynamic?: true;
102
+ assertionType?: string;
103
+ }
104
+ export interface ModuleJson extends CacheInfo {
105
+ /** The string URL of the module. */
106
+ specifier: string;
107
+ /** Any error encountered when attempting to load the module. */
108
+ error?: string;
109
+ /** The module kind that was determined when the module was resolved. This is
110
+ * used by loaders to indicate how a module needs to be loaded at runtime. */
111
+ kind?: ModuleKind;
112
+ /** An array of dependencies that were identified in the module. */
113
+ dependencies?: DependencyJson[];
114
+ /** If the module had a types dependency, the information about that
115
+ * dependency. */
116
+ typesDependency?: TypesDependencyJson;
117
+ /** The resolved media type of the module, which determines how Deno will
118
+ * handle the module. */
119
+ mediaType?: MediaType;
120
+ /** The size of the source content of the module in bytes. */
121
+ size?: number;
122
+ }
123
+ export interface GraphImportJson {
124
+ /** The referrer (URL string) that was used as a base when resolving the
125
+ * imports added to the graph. */
126
+ referrer: string;
127
+ /** An array of resolved dependencies which were imported using the
128
+ * referrer. */
129
+ dependencies?: DependencyJson[];
130
+ }
131
+ /** The plain-object representation of a module graph that is suitable for
132
+ * serialization to JSON. */
133
+ export interface ModuleGraphJson {
134
+ /** The module specifiers (URL string) of the _roots_ of the module graph of
135
+ * which the module graph was built for. */
136
+ roots: string[];
137
+ /** An array of modules that are part of the module graph. */
138
+ modules: ModuleJson[];
139
+ /** External imports that were added to the graph when it was being built.
140
+ * The key is the referrer which was used as a base to resolve the
141
+ * dependency. The value is the resolved dependency. */
142
+ imports?: GraphImportJson[];
143
+ /** A record/map of any redirects encountered when resolving modules. The
144
+ * key was the requested module specifier and the value is the redirected
145
+ * module specifier. */
146
+ redirects: Record<string, string>;
147
+ }
148
+ export interface Dependency {
149
+ /** An object pointing to the resolved _code_ dependency. */
150
+ code?: ResolvedDependency;
151
+ /** An object pointing to the resolved _type_ dependency of a module. This is
152
+ * populated when the `@deno-types` directive was used to supply a type
153
+ * definition file for a dependency. */
154
+ type?: ResolvedDependency;
155
+ /** A flag indicating if the dependency was dynamic. (e.g.
156
+ * `await import("mod.ts")`) */
157
+ isDynamic?: true;
158
+ }
@@ -0,0 +1,2 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/edge-bundler",
3
- "version": "10.1.2",
3
+ "version": "10.1.3",
4
4
  "description": "Intelligently prepare Netlify Edge Functions for deployment",
5
5
  "type": "module",
6
6
  "main": "./dist/node/index.js",
@@ -35,11 +35,11 @@
35
35
  "test:ci:vitest": "vitest run --coverage",
36
36
  "test:ci:deno": "deno test --allow-all deno",
37
37
  "test:integration": "node --experimental-modules test/integration/test.js",
38
- "vendor": "deno vendor --force --output deno/vendor https://deno.land/x/deno_graph@0.59.2/types.d.ts https://deno.land/x/eszip@v0.55.2/mod.ts https://deno.land/x/retry@v2.0.0/mod.ts https://deno.land/x/std@0.177.0/path/mod.ts"
38
+ "vendor": "deno vendor --force --output deno/vendor https://deno.land/x/eszip@v0.55.2/mod.ts https://deno.land/x/retry@v2.0.0/mod.ts https://deno.land/x/std@0.177.0/path/mod.ts"
39
39
  },
40
40
  "config": {
41
41
  "eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{node,scripts,.github}/**/*.{js,ts,md,html}\" \"*.{js,ts,md,html}\"",
42
- "prettier": "--ignore-path .gitignore --loglevel=warn \"{node,scripts,.github}/**/*.{js,ts,md,yml,json,html}\" \"*.{js,ts,yml,json,html}\" \".*.{js,ts,yml,json,html}\" \"!**/package-lock.json\" \"!package-lock.json\""
42
+ "prettier": "--ignore-path .gitignore --loglevel=warn \"{node,scripts,.github}/**/*.{js,ts,md,yml,json,html}\" \"*.{js,ts,yml,json,html}\" \".*.{js,ts,yml,json,html}\" \"!**/package-lock.json\" \"!package-lock.json\" \"!node/vendor/**\""
43
43
  },
44
44
  "keywords": [],
45
45
  "license": "MIT",
@@ -81,7 +81,7 @@
81
81
  "better-ajv-errors": "^1.2.0",
82
82
  "common-path-prefix": "^3.0.0",
83
83
  "env-paths": "^3.0.0",
84
- "esbuild": "0.19.5",
84
+ "esbuild": "0.19.6",
85
85
  "execa": "^6.0.0",
86
86
  "find-up": "^6.3.0",
87
87
  "get-package-name": "^2.2.0",
@@ -1,20 +0,0 @@
1
- // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
-
3
- export enum MediaType {
4
- JavaScript = "JavaScript",
5
- Mjs = "Mjs",
6
- Cjs = "Cjs",
7
- Jsx = "Jsx",
8
- TypeScript = "TypeScript",
9
- Mts = "Mts",
10
- Cts = "Cts",
11
- Dts = "Dts",
12
- Dmts = "Dmts",
13
- Dcts = "Dcts",
14
- Tsx = "Tsx",
15
- Json = "Json",
16
- Wasm = "Wasm",
17
- TsBuildInfo = "TsBuildInfo",
18
- SourceMap = "SourceMap",
19
- Unknown = "Unknown",
20
- }
@@ -1,182 +0,0 @@
1
- // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
-
3
- import type { MediaType } from "./media_type.ts";
4
-
5
- /** Additional meta data that is used to enrich the output of the module
6
- * graph. */
7
- export interface CacheInfo {
8
- /** The string path to where the local version of the content is located. For
9
- * non `file:` URLs, this is the location of the cached content, otherwise it
10
- * is the absolute path to the local file. */
11
- local?: string;
12
- /** The string path to where a transpiled version of the source content is
13
- * located, if any. */
14
- emit?: string;
15
- /** The string path to where an external source map of the transpiled source
16
- * content is located, if any. */
17
- map?: string;
18
- }
19
-
20
- export interface TypesDependency {
21
- /** The string URL to the type information for the module. */
22
- types: string;
23
- /** An optional range which indicates the source of the dependency. */
24
- source?: Range;
25
- }
26
-
27
- export interface LoadResponseModule {
28
- /** A module with code has been loaded. */
29
- kind: "module";
30
- /** The string URL of the resource. If there were redirects, the final
31
- * specifier should be set here, otherwise the requested specifier. */
32
- specifier: string;
33
- /** For remote resources, a record of headers should be set, where the key's
34
- * have been normalized to be lower case values. */
35
- headers?: Record<string, string>;
36
- /** The string value of the loaded resources. */
37
- content: string;
38
- }
39
-
40
- export interface LoadResponseExternal {
41
- /** The loaded module is either _external_ or _built-in_ to the runtime. */
42
- kind: "external";
43
- /** The strung URL of the resource. If there were redirects, the final
44
- * specifier should be set here, otherwise the requested specifier. */
45
- specifier: string;
46
- }
47
-
48
- export type LoadResponse = LoadResponseModule | LoadResponseExternal;
49
-
50
- export interface PositionJson {
51
- /** The line number of a position within a source file. The number is a zero
52
- * based index. */
53
- line: number;
54
- /** The character number of a position within a source file. The number is a
55
- * zero based index. */
56
- character: number;
57
- }
58
-
59
- export interface Range {
60
- /** A string URL representing a source of a dependency. */
61
- specifier: string;
62
- /** The start location of a range of text in a source file. */
63
- start?: PositionJson;
64
- /** The end location of a range of text in a source file. */
65
- end?: PositionJson;
66
- }
67
-
68
- export interface RangeJson {
69
- /** The start location of a range of text in a source file. */
70
- start: PositionJson;
71
- /** The end location of a range of text in a source file. */
72
- end: PositionJson;
73
- }
74
-
75
- export interface ResolvedDependency {
76
- /** The fully resolved string URL of the dependency, which should be
77
- * resolvable in the module graph. If there was an error, `error` will be set
78
- * and this will be undefined. */
79
- specifier?: string;
80
- /** Any error encountered when trying to resolved the specifier. If this is
81
- * defined, `specifier` will be undefined. */
82
- error?: string;
83
- /** The range within the source code where the specifier was identified. */
84
- span: RangeJson;
85
- }
86
-
87
- export interface TypesDependencyJson {
88
- /** The string specifier that was used for the dependency. */
89
- specifier: string;
90
- /** An object pointing to the resolved dependency. */
91
- dependency: ResolvedDependency;
92
- }
93
-
94
- /** The kind of module.
95
- *
96
- * For asserted modules, the value of the `asserted` property is set to the
97
- * `type` value of the import attribute.
98
- *
99
- * Dependency analysis is not performed for asserted or Script modules
100
- * currently. Synthetic modules were injected into the graph with their own
101
- * dependencies provided. */
102
- export type ModuleKind =
103
- | "asserted"
104
- | "esm"
105
- | "npm"
106
- | "external";
107
-
108
- export interface DependencyJson {
109
- /** The string specifier that was used for the dependency. */
110
- specifier: string;
111
- /** An object pointing to the resolved _code_ dependency. */
112
- code?: ResolvedDependency;
113
- /** An object pointing to the resolved _type_ dependency of a module. This is
114
- * populated when the `@deno-types` directive was used to supply a type
115
- * definition file for a dependency. */
116
- type?: ResolvedDependency;
117
- /** A flag indicating if the dependency was dynamic. (e.g.
118
- * `await import("mod.ts")`) */
119
- isDynamic?: true;
120
- assertionType?: string;
121
- }
122
-
123
- // todo(dsherret): split this up into separate types based on the "kind"
124
-
125
- export interface ModuleJson extends CacheInfo {
126
- /** The string URL of the module. */
127
- specifier: string;
128
- /** Any error encountered when attempting to load the module. */
129
- error?: string;
130
- /** The module kind that was determined when the module was resolved. This is
131
- * used by loaders to indicate how a module needs to be loaded at runtime. */
132
- kind?: ModuleKind;
133
- /** An array of dependencies that were identified in the module. */
134
- dependencies?: DependencyJson[];
135
- /** If the module had a types dependency, the information about that
136
- * dependency. */
137
- typesDependency?: TypesDependencyJson;
138
- /** The resolved media type of the module, which determines how Deno will
139
- * handle the module. */
140
- mediaType?: MediaType;
141
- /** The size of the source content of the module in bytes. */
142
- size?: number;
143
- }
144
-
145
- export interface GraphImportJson {
146
- /** The referrer (URL string) that was used as a base when resolving the
147
- * imports added to the graph. */
148
- referrer: string;
149
- /** An array of resolved dependencies which were imported using the
150
- * referrer. */
151
- dependencies?: DependencyJson[];
152
- }
153
-
154
- /** The plain-object representation of a module graph that is suitable for
155
- * serialization to JSON. */
156
- export interface ModuleGraphJson {
157
- /** The module specifiers (URL string) of the _roots_ of the module graph of
158
- * which the module graph was built for. */
159
- roots: string[];
160
- /** An array of modules that are part of the module graph. */
161
- modules: ModuleJson[];
162
- /** External imports that were added to the graph when it was being built.
163
- * The key is the referrer which was used as a base to resolve the
164
- * dependency. The value is the resolved dependency. */
165
- imports?: GraphImportJson[];
166
- /** A record/map of any redirects encountered when resolving modules. The
167
- * key was the requested module specifier and the value is the redirected
168
- * module specifier. */
169
- redirects: Record<string, string>;
170
- }
171
-
172
- export interface Dependency {
173
- /** An object pointing to the resolved _code_ dependency. */
174
- code?: ResolvedDependency;
175
- /** An object pointing to the resolved _type_ dependency of a module. This is
176
- * populated when the `@deno-types` directive was used to supply a type
177
- * definition file for a dependency. */
178
- type?: ResolvedDependency;
179
- /** A flag indicating if the dependency was dynamic. (e.g.
180
- * `await import("mod.ts")`) */
181
- isDynamic?: true;
182
- }