@remix-run/node 1.2.0-pre.1 → 1.2.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.
package/base64.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/cookieSigning.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/fetch.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/formData.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/globals.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { AbortController } from "abort-controller";
2
- export { formatServerError } from "./errors";
3
2
  export type { HeadersInit, RequestInfo, RequestInit, ResponseInit } from "./fetch";
4
3
  export { Headers, Request, Response, fetch } from "./fetch";
5
4
  export { FormData } from "./formData";
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -12,8 +12,8 @@
12
12
 
13
13
  Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
+ var sourceMapSupport = require('source-map-support');
15
16
  var abortController = require('abort-controller');
16
- var errors = require('./errors.js');
17
17
  var fetch = require('./fetch.js');
18
18
  var formData = require('./formData.js');
19
19
  var globals = require('./globals.js');
@@ -23,13 +23,16 @@ var fileUploadHandler = require('./upload/fileUploadHandler.js');
23
23
  var memoryUploadHandler = require('./upload/memoryUploadHandler.js');
24
24
  var nodeFetch = require('node-fetch');
25
25
 
26
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
27
 
28
+ var sourceMapSupport__default = /*#__PURE__*/_interopDefaultLegacy(sourceMapSupport);
29
+
30
+ sourceMapSupport__default["default"].install();
27
31
 
28
32
  Object.defineProperty(exports, 'AbortController', {
29
33
  enumerable: true,
30
34
  get: function () { return abortController.AbortController; }
31
35
  });
32
- exports.formatServerError = errors.formatServerError;
33
36
  exports.Request = fetch.Request;
34
37
  exports.fetch = fetch.fetch;
35
38
  exports.FormData = formData.FormData;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@remix-run/node",
3
3
  "description": "Node.js platform abstractions for Remix",
4
- "version": "1.2.0-pre.1",
4
+ "version": "1.2.2",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  "url": "https://github.com/remix-run/remix/issues"
13
13
  },
14
14
  "dependencies": {
15
- "@remix-run/server-runtime": "1.2.0-pre.1",
15
+ "@remix-run/server-runtime": "1.2.2",
16
16
  "@types/busboy": "^0.3.1",
17
17
  "@types/node-fetch": "^2.5.12",
18
18
  "@web-std/file": "^3.0.0",
@@ -22,11 +22,12 @@
22
22
  "cookie-signature": "^1.1.0",
23
23
  "form-data": "^4.0.0",
24
24
  "node-fetch": "^2.6.1",
25
- "source-map": "^0.7.3"
25
+ "source-map-support": "^0.5.21"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/blob-stream": "^0.1.30",
29
- "@types/cookie-signature": "^1.0.3"
29
+ "@types/cookie-signature": "^1.0.3",
30
+ "@types/source-map-support": "^0.5.4"
30
31
  },
31
32
  "sideEffects": false
32
33
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
15
  var crypto = require('crypto');
16
16
  var fs = require('fs');
17
- var fsp = require('fs/promises');
17
+ var promises = require('fs/promises');
18
18
  var os = require('os');
19
19
  var path = require('path');
20
20
  var meter = require('./meter.js');
@@ -30,7 +30,7 @@ async function uniqueFile(filepath) {
30
30
  let ext = path.extname(filepath);
31
31
  let uniqueFilepath = filepath;
32
32
 
33
- for (let i = 1; await fsp.stat(uniqueFilepath).then(() => true).catch(() => false); i++) {
33
+ for (let i = 1; await promises.stat(uniqueFilepath).then(() => true).catch(() => false); i++) {
34
34
  uniqueFilepath = (ext ? filepath.slice(0, -ext.length) : filepath) + `-${new Date().getTime()}${ext}`;
35
35
  }
36
36
 
@@ -89,7 +89,7 @@ function createFileUploadHandler({
89
89
  filepath = await uniqueFile(filepath);
90
90
  }
91
91
 
92
- await fsp.mkdir(path.dirname(filepath), {
92
+ await promises.mkdir(path.dirname(filepath), {
93
93
  recursive: true
94
94
  }).catch(() => {});
95
95
  let meter$1 = new meter.Meter(name, maxFileSize);
@@ -105,7 +105,7 @@ function createFileUploadHandler({
105
105
  stream.removeAllListeners();
106
106
  meter$1.removeAllListeners();
107
107
  writeFileStream.removeAllListeners();
108
- await fsp.rm(filepath, {
108
+ await promises.rm(filepath, {
109
109
  force: true
110
110
  }).catch(() => {});
111
111
  reject(error);
@@ -150,7 +150,7 @@ class NodeOnDiskFile {
150
150
  }
151
151
 
152
152
  text() {
153
- return fsp.readFile(this.filepath, "utf-8");
153
+ return promises.readFile(this.filepath, "utf-8");
154
154
  }
155
155
 
156
156
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/upload/meter.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.2.0-pre.1
2
+ * @remix-run/node v1.2.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/errors.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { NullableMappedPosition } from "source-map";
2
- import { SourceMapConsumer } from "source-map";
3
- export declare const UNKNOWN_LOCATION_POSITION = "<unknown location>";
4
- export declare function formatServerError(error: Error): Promise<Error>;
5
- export declare function formatStackTrace(error: Error): Promise<string | undefined>;
6
- export declare function mapToSourceFile(cache: Map<string, SourceMapConsumer>, stackLine: string): Promise<string>;
7
- export declare function relativeFilename(filename: string): string;
8
- export declare function getOriginalSourcePosition(smc: SourceMapConsumer, line: number, column: number): NullableMappedPosition;
9
- export declare function getSourceContentForPosition(smc: SourceMapConsumer, pos: NullableMappedPosition): string;
package/errors.js DELETED
@@ -1,123 +0,0 @@
1
- /**
2
- * @remix-run/node v1.2.0-pre.1
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */
11
- 'use strict';
12
-
13
- Object.defineProperty(exports, '__esModule', { value: true });
14
-
15
- var fs = require('fs');
16
- var fsp = require('fs/promises');
17
- var path = require('path');
18
- var sourceMap = require('source-map');
19
-
20
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
-
22
- var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
23
- var fsp__default = /*#__PURE__*/_interopDefaultLegacy(fsp);
24
- var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
25
-
26
- const ROOT = process.cwd() + path__default["default"].sep;
27
- const SOURCE_PATTERN = /(?<at>\s+at.+)\((?<filename>.+):(?<line>\d+):(?<column>\d+)\)/;
28
- const UNKNOWN_LOCATION_POSITION = "<unknown location>";
29
- async function formatServerError(error) {
30
- try {
31
- error.stack = await formatStackTrace(error);
32
- } catch {}
33
-
34
- return error;
35
- }
36
- async function formatStackTrace(error) {
37
- var _error$stack;
38
-
39
- const cache = new Map();
40
- const lines = ((_error$stack = error.stack) === null || _error$stack === void 0 ? void 0 : _error$stack.split("\n")) || [];
41
- const promises = lines.map(line => mapToSourceFile(cache, line));
42
- const stack = (await Promise.all(promises)).join("\n") || error.stack;
43
- return stack;
44
- }
45
- async function mapToSourceFile(cache, stackLine) {
46
- let match = SOURCE_PATTERN.exec(stackLine);
47
-
48
- if (!(match !== null && match !== void 0 && match.groups)) {
49
- // doesn't match pattern but may still have a filename
50
- return relativeFilename(stackLine);
51
- }
52
-
53
- let {
54
- at,
55
- filename
56
- } = match.groups;
57
- let line = match.groups.line;
58
- let column = match.groups.column;
59
- let mapFilename = `${filename}.map`;
60
- let smc = cache.get(mapFilename);
61
- filename = relativeFilename(filename);
62
-
63
- if (!smc) {
64
- if (await fileExists(mapFilename)) {
65
- // read source map and setup consumer
66
- const map = JSON.parse(await fsp__default["default"].readFile(mapFilename, "utf-8"));
67
- map.sourceRoot = path__default["default"].dirname(mapFilename);
68
- smc = await new sourceMap.SourceMapConsumer(map);
69
- cache.set(mapFilename, smc);
70
- }
71
- }
72
-
73
- if (smc) {
74
- const pos = getOriginalSourcePosition(smc, parseInt(line, 10), parseInt(column, 10));
75
-
76
- if (pos.source) {
77
- filename = relativeFilename(pos.source);
78
- line = pos.line || "?";
79
- column = pos.column || "?";
80
- at = ` at \`${getSourceContentForPosition(smc, pos)}\` `;
81
- }
82
- }
83
-
84
- return `${at}(${filename}:${line}:${column})`;
85
- }
86
- function relativeFilename(filename) {
87
- if (filename.includes("route-module:")) {
88
- filename = filename.substring(filename.indexOf("route-module:"));
89
- }
90
-
91
- return filename.replace("route-module:", "").replace(ROOT, "./");
92
- }
93
- function getOriginalSourcePosition(smc, line, column) {
94
- return smc.originalPositionFor({
95
- line,
96
- column
97
- });
98
- }
99
- function getSourceContentForPosition(smc, pos) {
100
- let src = null;
101
-
102
- if (pos !== null && pos !== void 0 && pos.source && typeof pos.line === "number") {
103
- src = smc.sourceContentFor(pos.source);
104
- }
105
-
106
- if (!src) {
107
- return UNKNOWN_LOCATION_POSITION;
108
- }
109
-
110
- return src.split("\n")[pos.line - 1].trim();
111
- }
112
-
113
- function fileExists(filename) {
114
- return fsp__default["default"].access(filename, fs__default["default"].constants.F_OK).then(() => true).catch(() => false);
115
- }
116
-
117
- exports.UNKNOWN_LOCATION_POSITION = UNKNOWN_LOCATION_POSITION;
118
- exports.formatServerError = formatServerError;
119
- exports.formatStackTrace = formatStackTrace;
120
- exports.getOriginalSourcePosition = getOriginalSourcePosition;
121
- exports.getSourceContentForPosition = getSourceContentForPosition;
122
- exports.mapToSourceFile = mapToSourceFile;
123
- exports.relativeFilename = relativeFilename;