dbx-tools-node-runtime 0.9.119__tar.gz → 0.9.120__tar.gz

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
1
  Metadata-Version: 2.4
2
2
  Name: dbx-tools-node-runtime
3
- Version: 0.9.119
3
+ Version: 0.9.120
4
4
  Summary: Shared PythonMonkey runtime and lazy Node.js bootstrap
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dbx-tools-node-runtime"
3
- version = "0.9.119"
3
+ version = "0.9.120"
4
4
  description = "Shared PythonMonkey runtime and lazy Node.js bootstrap"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10,<4"
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "dbx-tools-node-runtime"
5
- version = "0.9.119"
5
+ version = "0.9.120"
6
6
  description = "Shared PythonMonkey runtime and lazy Node.js bootstrap"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.10,<4"
@@ -11854,6 +11854,28 @@ __export(exports_node___fs, {
11854
11854
  });
11855
11855
  var import_node_stream2 = __toESM(require_stream_browserify(), 1);
11856
11856
 
11857
+ // packages/py/node-runtime/shims/fs-errors.ts
11858
+ function nodeError(error, code, path) {
11859
+ return Object.assign(error instanceof Error ? error : new Error(String(error)), { code, path });
11860
+ }
11861
+ function translatePythonError(cause, path) {
11862
+ const message = String(cause);
11863
+ if (/FileNotFoundError|Errno 2/.test(message))
11864
+ throw nodeError(cause, "ENOENT", path);
11865
+ if (/FileExistsError|Errno 17/.test(message))
11866
+ throw nodeError(cause, "EEXIST", path);
11867
+ if (/PermissionError|Errno 13/.test(message))
11868
+ throw nodeError(cause, "EACCES", path);
11869
+ throw cause;
11870
+ }
11871
+ function withPythonPath(path, operation) {
11872
+ try {
11873
+ return operation();
11874
+ } catch (cause) {
11875
+ translatePythonError(cause, path);
11876
+ }
11877
+ }
11878
+
11857
11879
  // packages/py/node-runtime/shims/node___fs__promises.ts
11858
11880
  var exports_node___fs__promises = {};
11859
11881
  __export(exports_node___fs__promises, {
@@ -11875,19 +11897,6 @@ __export(exports_node___fs__promises, {
11875
11897
  writeFile: () => writeFile
11876
11898
  });
11877
11899
  var import_node_buffer2 = __toESM(require_buffer(), 1);
11878
- function nodeError(error, code, path) {
11879
- return Object.assign(error instanceof Error ? error : new Error(String(error)), { code, path });
11880
- }
11881
- function translatePythonError(cause, path) {
11882
- const message = String(cause);
11883
- if (/FileNotFoundError|Errno 2/.test(message))
11884
- throw nodeError(cause, "ENOENT", path);
11885
- if (/FileExistsError|Errno 17/.test(message))
11886
- throw nodeError(cause, "EEXIST", path);
11887
- if (/PermissionError|Errno 13/.test(message))
11888
- throw nodeError(cause, "EACCES", path);
11889
- throw cause;
11890
- }
11891
11900
  async function access(path) {
11892
11901
  try {
11893
11902
  await pythonHost().file.stat(String(path));
@@ -12018,10 +12027,10 @@ function existsSync(path) {
12018
12027
  return pythonHost().file.exists(String(path));
12019
12028
  }
12020
12029
  function readFileSync(path, _encoding) {
12021
- return pythonHost().file.readTextSync(String(path));
12030
+ return withPythonPath(path, () => pythonHost().file.readTextSync(String(path)));
12022
12031
  }
12023
12032
  function readdirSync(path, options = {}) {
12024
- const entries = pythonHost().file.readDirectorySync(String(path));
12033
+ const entries = withPythonPath(path, () => pythonHost().file.readDirectorySync(String(path)));
12025
12034
  if (!options.withFileTypes)
12026
12035
  return entries.map((entry) => entry.name);
12027
12036
  return entries.map((entry) => ({
@@ -12032,14 +12041,14 @@ function readdirSync(path, options = {}) {
12032
12041
  }));
12033
12042
  }
12034
12043
  function readlinkSync(path) {
12035
- return pythonHost().file.readLinkSync(String(path));
12044
+ return withPythonPath(path, () => pythonHost().file.readLinkSync(String(path)));
12036
12045
  }
12037
12046
  function realpathSync(path) {
12038
- return pythonHost().file.realpathSync(String(path));
12047
+ return withPythonPath(path, () => pythonHost().file.realpathSync(String(path)));
12039
12048
  }
12040
12049
  realpathSync.native = realpathSync;
12041
12050
  function lstatSync(path) {
12042
- const value = pythonHost().file.statSync(String(path));
12051
+ const value = withPythonPath(path, () => pythonHost().file.statSync(String(path)));
12043
12052
  return {
12044
12053
  mode: value.mode,
12045
12054
  mtime: new Date(value.mtimeMs),