-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from Shopify/js.return-error-when-module-errors
optionally return non-zero error code when function run sees error
- Loading branch information
Showing
15 changed files
with
132 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
var __defProp = Object.defineProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
|
||
// node_modules/javy/dist/fs/index.js | ||
var o = /* @__PURE__ */ ((r) => (r[r.Stdin = 0] = "Stdin", r[r.Stdout = 1] = "Stdout", r[r.Stderr = 2] = "Stderr", r))(o || {}); | ||
function a(r) { | ||
let e = new Uint8Array(1024), t = 0; | ||
for (; ;) { | ||
const i = Javy.IO.readSync(r, e.subarray(t)); | ||
if (i < 0) | ||
throw Error("Error while reading from file descriptor"); | ||
if (i === 0) | ||
return e.subarray(0, t + i); | ||
if (t += i, t === e.length) { | ||
const n = new Uint8Array(e.length * 2); | ||
n.set(e), e = n; | ||
} | ||
} | ||
} | ||
function s(r, e) { | ||
for (; e.length > 0;) { | ||
const t = Javy.IO.writeSync(r, e); | ||
if (t < 0) | ||
throw Error("Error while writing to file descriptor"); | ||
e = e.subarray(t); | ||
} | ||
} | ||
|
||
// extensions/volume-js/src/index.js | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
default: () => src_default | ||
}); | ||
var EMPTY_DISCOUNT = { | ||
discountApplicationStrategy: "FIRST" /* First */, | ||
discounts: [] | ||
}; | ||
var src_default = (input) => { | ||
throw Error("A problem occurred.") | ||
}; | ||
|
||
// node_modules/@shopify/shopify_function/index.ts | ||
var input_data = a(o.Stdin); | ||
var input_str = new TextDecoder("utf-8").decode(input_data); | ||
var input_obj = JSON.parse(input_str); | ||
var output_obj = src_exports?.default(input_obj); | ||
var output_str = JSON.stringify(output_obj); | ||
var output_data = new TextEncoder().encode(output_str); | ||
s(o.Stdout, output_data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "noop" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
nanoserde = "0.1.37" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use std::io; | ||
use std::io::Write; | ||
|
||
fn main() -> std::io::Result<()> { | ||
let input_string = io::read_to_string(io::stdin())?; | ||
std::io::stdout().write_all(input_string.as_bytes())?; | ||
std::io::stdout().flush()?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters