@netlify/edge-bundler 2.0.3 → 2.0.5
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { join
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
1
|
+
import { join } from 'path';
|
|
3
2
|
import { wrapBundleError } from '../bundle_error.js';
|
|
3
|
+
import { getPackagePath } from '../package_json.js';
|
|
4
4
|
import { getFileHash } from '../utils/sha256.js';
|
|
5
5
|
const bundleESZIP = async ({ basePath, buildID, debug, deno, distDirectory, functions, importMap, }) => {
|
|
6
6
|
const extension = '.eszip';
|
|
@@ -26,9 +26,8 @@ const bundleESZIP = async ({ basePath, buildID, debug, deno, distDirectory, func
|
|
|
26
26
|
return { extension, format: 'eszip2', hash };
|
|
27
27
|
};
|
|
28
28
|
const getESZIPBundler = () => {
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const bundlerPath = resolve(pathname, '../../../deno/bundle.ts');
|
|
29
|
+
const packagePath = getPackagePath();
|
|
30
|
+
const bundlerPath = join(packagePath, 'deno', 'bundle.ts');
|
|
32
31
|
return bundlerPath;
|
|
33
32
|
};
|
|
34
33
|
export { bundleESZIP as bundle };
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { readFileSync } from 'fs';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { findUpSync, pathExistsSync } from 'find-up';
|
|
5
|
+
const getPackagePath = () => {
|
|
6
|
+
const packagePath = findUpSync((directory) => {
|
|
7
|
+
if (pathExistsSync(join(directory, 'package.json'))) {
|
|
8
|
+
return directory;
|
|
9
|
+
}
|
|
10
|
+
}, { cwd: fileURLToPath(import.meta.url), type: 'directory' });
|
|
11
|
+
// We should never get here, but let's show a somewhat useful error message.
|
|
12
|
+
if (packagePath === undefined) {
|
|
13
|
+
throw new Error('Could not find `package.json` for `@netlify/edge-bundler`. Please try running `npm install` to reinstall your dependencies.');
|
|
7
14
|
}
|
|
15
|
+
return packagePath;
|
|
16
|
+
};
|
|
17
|
+
const getPackageVersion = () => {
|
|
18
|
+
const packagePath = getPackagePath();
|
|
8
19
|
try {
|
|
9
|
-
const packageJSON = readFileSync(
|
|
20
|
+
const packageJSON = readFileSync(join(packagePath, 'package.json'), 'utf8');
|
|
10
21
|
const { version } = JSON.parse(packageJSON);
|
|
11
22
|
return version;
|
|
12
23
|
}
|
|
@@ -14,4 +25,4 @@ const getPackageVersion = () => {
|
|
|
14
25
|
return '';
|
|
15
26
|
}
|
|
16
27
|
};
|
|
17
|
-
export { getPackageVersion };
|
|
28
|
+
export { getPackagePath, getPackageVersion };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/edge-bundler",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Intelligently prepare Netlify Edge Functions for deployment",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/node/index.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"husky": "^8.0.0",
|
|
73
73
|
"nock": "^13.2.4",
|
|
74
74
|
"nyc": "^15.0.0",
|
|
75
|
-
"sinon": "^
|
|
75
|
+
"sinon": "^14.0.0",
|
|
76
76
|
"ts-node": "^10.4.0",
|
|
77
77
|
"typescript": "^4.5.4"
|
|
78
78
|
},
|