Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/toml-V4Savzlc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/toml-V4Savzlc.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion esm/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const handleCustomType = async (node) => {
env,
onerror,
hooks,
parser,
} = options;

let error;
Expand All @@ -69,7 +70,7 @@ export const handleCustomType = async (node) => {
let url = configURL;
let cfg = node.getAttribute('config') || config || {};
if (!v || !cfg) {
const [o, u] = resolveConfig(cfg, configURL);
const [o, u] = resolveConfig(cfg, configURL, { parser });
cfg = await o;
url = u;
v = cfg.version || cfg.interpreter;
Expand All @@ -82,6 +83,7 @@ export const handleCustomType = async (node) => {

const xworker = XW.call(new Hook(null, hooks), worker, {
...nodeInfo(node, type),
parser,
configURL: url,
version: v,
type: runtime,
Expand Down
3 changes: 2 additions & 1 deletion esm/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { buffered } from './interpreter/_io.js';
import { createProgress } from './interpreter/_utils.js';
import { loadProgress as lP } from './interpreter/_python.js';
import { registry } from './interpreters.js';
import { toml } from './3rd-party.js';

const loadProgress = (type, ...rest) => lP(registry.get(type), ...rest);

export { buffered, createProgress, loadProgress };
export { buffered, createProgress, loadProgress, toml };
export * from './index.js';
export * from './script-handler.js';
export * from './utils.js';
6 changes: 5 additions & 1 deletion esm/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export const resolveConfig = (config, configURL, options = {}) => {
if (type === 'json') {
options = fetch(absolute).json();
} else if (type === 'toml') {
options = fetch(absolute).text().then(toml);
options = fetch(absolute).text().then(async value => {
const { parser } = options;
const module = parser ? await import(parser) : { parse: toml };
return (module.parse || module.default)(value);
});
} else if (type === 'string') {
options = parseString(config);
} else if (type === 'object' && config) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@
"to-json-callback": "^0.1.1"
},
"worker": {
"blob": "sha256-ApE1J3NhEObM1H24FVV9LhqLlLGKcfe+iUy+8s/CKJE="
"blob": "sha256-sbA8E5hS+A6qJj6Hff1Hz/8P9X6JwySkRYqkLfX+gDw="
}
}