@weborigami/origami 0.3.3 → 0.3.4-jse.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.
- package/main.js +1 -3
- package/package.json +4 -4
- package/src/BuiltinsTree.js +18 -0
- package/src/builtinsJse.js +67 -0
- package/src/builtinsShell.js +52 -0
- package/src/cli/getConfig.js +10 -0
- package/src/common/documentObject.js +8 -2
- package/src/common/fetchAndHandleExtension.js +3 -2
- package/src/common/utilities.js +2 -2
- package/src/dev/ExplorableSiteTransform.js +2 -2
- package/src/dev/crawler/crawlResources.js +1 -1
- package/src/dev/crawler/pathsInHtml.js +2 -0
- package/src/dev/explore.js +3 -8
- package/src/dev/explore.js.inline +2 -2
- package/src/dev/explore.ori +6 -6
- package/src/handlers/css.handler.js +2 -2
- package/src/handlers/handlerBuiltins.js +26 -0
- package/src/handlers/handlers.js +36 -40
- package/src/handlers/htm.handler.js +1 -1
- package/src/handlers/html.handler.js +2 -2
- package/src/handlers/jpg.handler.js +1 -1
- package/src/handlers/js.handler.js +1 -1
- package/src/handlers/jse.handler.js +17 -0
- package/src/handlers/jsedocument.handler.js +17 -0
- package/src/handlers/md.handler.js +2 -2
- package/src/handlers/mjs.handler.js +1 -1
- package/src/handlers/ori.handler.js +15 -5
- package/src/handlers/oridocument.handler.js +15 -2
- package/src/{common → handlers}/processUnpackedContent.js +1 -3
- package/src/handlers/ts.handler.js +1 -1
- package/src/handlers/txt.handler.js +9 -1
- package/src/handlers/wasm.handler.js +1 -1
- package/src/handlers/yaml.handler.js +1 -1
- package/src/handlers/yml.handler.js +1 -1
- package/src/help/help.yaml +1 -11
- package/src/origami/config.js +2 -4
- package/src/origami/ori.js +17 -4
- package/src/origami/origami.js +0 -5
- package/src/origami/project.js +66 -56
- package/src/origami/regexMatch.js +4 -0
- package/src/protocols/files.js +2 -1
- package/src/protocols/inherited.js +6 -3
- package/src/protocols/new.js +4 -0
- package/src/protocols/node.js +13 -0
- package/src/protocols/scope.js +3 -3
- package/src/site/{index.js → indexPage.js} +1 -1
- package/src/site/site.js +1 -1
- package/src/site/sitemap.js +3 -4
- package/src/site/static.js +1 -1
- package/src/text/inline.js +19 -14
- package/src/text/mdHtml.js +2 -1
- package/src/tree/map.js +1 -1
- package/src/builtins.js +0 -58
- package/src/builtinsTree.js +0 -36
- package/src/calc/calc.js +0 -81
- package/src/handlers/handlerExports.js +0 -16
- package/src/internal.js +0 -24
- package/src/js.js +0 -38
- package/src/node.js +0 -22
package/src/calc/calc.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Tree } from "@weborigami/async-tree";
|
|
2
|
-
import assertTreeIsDefined from "../common/assertTreeIsDefined.js";
|
|
3
|
-
|
|
4
|
-
export function add(...args) {
|
|
5
|
-
console.warn(`Warning: "add" is deprecated. Use the "+" operator instead.`);
|
|
6
|
-
const numbers = args.map((arg) => Number(arg));
|
|
7
|
-
return numbers.reduce((acc, val) => acc + val, 0);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function and(...args) {
|
|
11
|
-
console.warn(`Warning: "and" is deprecated. Use the "&&" operator instead.`);
|
|
12
|
-
return args.every((arg) => arg);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function divide(a, b) {
|
|
16
|
-
console.warn(
|
|
17
|
-
`Warning: "divide" is deprecated. Use the "/" operator instead.`
|
|
18
|
-
);
|
|
19
|
-
return Number(a) / Number(b);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function equals(a, b) {
|
|
23
|
-
console.warn(
|
|
24
|
-
`Warning: "equals" is deprecated. Use the "===" operator instead.`
|
|
25
|
-
);
|
|
26
|
-
return a === b;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {import("@weborigami/types").AsyncTree} AsyncTree
|
|
31
|
-
*
|
|
32
|
-
* @this {AsyncTree|null}
|
|
33
|
-
* @param {any} value
|
|
34
|
-
* @param {any} trueResult
|
|
35
|
-
* @param {any} [falseResult]
|
|
36
|
-
*/
|
|
37
|
-
export async function ifBuiltin(value, trueResult, falseResult) {
|
|
38
|
-
console.warn(
|
|
39
|
-
`Warning: "if" is deprecated. Use the conditional "a ? b : c" operator instead.`
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
assertTreeIsDefined(this, "calc:if");
|
|
43
|
-
let condition = await value;
|
|
44
|
-
if (Tree.isAsyncTree(condition)) {
|
|
45
|
-
const keys = Array.from(await condition.keys());
|
|
46
|
-
condition = keys.length > 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 0 is true, null/undefined/false is false
|
|
50
|
-
let result = condition || condition === 0 ? trueResult : falseResult;
|
|
51
|
-
if (typeof result === "function") {
|
|
52
|
-
result = await result.call(this);
|
|
53
|
-
}
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
ifBuiltin.key = "if";
|
|
57
|
-
|
|
58
|
-
export function multiply(...args) {
|
|
59
|
-
console.warn(
|
|
60
|
-
`Warning: "multiply" is deprecated. Use the "*" operator instead.`
|
|
61
|
-
);
|
|
62
|
-
const numbers = args.map((arg) => Number(arg));
|
|
63
|
-
return numbers.reduce((acc, val) => acc * val, 1);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function not(value) {
|
|
67
|
-
console.warn(`Warning: "not" is deprecated. Use the "!" operator instead.`);
|
|
68
|
-
return !value;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function or(...args) {
|
|
72
|
-
console.warn(`Warning: "or" is deprecated. Use the "||" operator instead.`);
|
|
73
|
-
return args.find((arg) => arg);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function subtract(a, b) {
|
|
77
|
-
console.warn(
|
|
78
|
-
`Warning: "subtract" is deprecated. Use the "-" operator instead.`
|
|
79
|
-
);
|
|
80
|
-
return Number(a) - Number(b);
|
|
81
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { default as cssHandler } from "./css.handler.js";
|
|
2
|
-
export { default as htmHandler } from "./htm.handler.js";
|
|
3
|
-
export { default as htmlHandler } from "./html.handler.js";
|
|
4
|
-
export { default as jpegHandler } from "./jpeg.handler.js";
|
|
5
|
-
export { default as jpgHandler } from "./jpg.handler.js";
|
|
6
|
-
export { default as jsHandler } from "./js.handler.js";
|
|
7
|
-
export { default as jsonHandler } from "./json.handler.js";
|
|
8
|
-
export { default as mdHandler } from "./md.handler.js";
|
|
9
|
-
export { default as mjsHandler } from "./mjs.handler.js";
|
|
10
|
-
export { default as oriHandler } from "./ori.handler.js";
|
|
11
|
-
export { default as oridocumentHandler } from "./oridocument.handler.js";
|
|
12
|
-
export { default as txtHandler } from "./txt.handler.js";
|
|
13
|
-
export { default as wasmHandler } from "./wasm.handler.js";
|
|
14
|
-
export { default as xhtmlHandler } from "./xhtml.handler.js";
|
|
15
|
-
export { default as yamlHandler } from "./yaml.handler.js";
|
|
16
|
-
export { default as ymlHandler } from "./yml.handler.js";
|
package/src/internal.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// This library includes a number of modules with circular dependencies. This
|
|
3
|
-
// module exists to explicitly set the loading order for those modules. To
|
|
4
|
-
// enforce use of this loading order, other modules should only load the modules
|
|
5
|
-
// below via this module.
|
|
6
|
-
//
|
|
7
|
-
// About this pattern:
|
|
8
|
-
// https://medium.com/visual-development/how-to-fix-nasty-circular-dependency-issues-once-and-for-all-in-javascript-typescript-a04c987cf0de
|
|
9
|
-
//
|
|
10
|
-
// Note: to avoid having VS Code auto-sort the imports, keep lines between them.
|
|
11
|
-
|
|
12
|
-
export { default as jsHandler } from "./handlers/js.handler.js";
|
|
13
|
-
|
|
14
|
-
export { default as oriHandler } from "./handlers/ori.handler.js";
|
|
15
|
-
|
|
16
|
-
export { default as oridocumentHandler } from "./handlers/oridocument.handler.js";
|
|
17
|
-
|
|
18
|
-
export { default as processUnpackedContent } from "./common/processUnpackedContent.js";
|
|
19
|
-
|
|
20
|
-
export { default as wasmHandler } from "./handlers/wasm.handler.js";
|
|
21
|
-
|
|
22
|
-
export { default as yamlHandler } from "./handlers/yaml.handler.js";
|
|
23
|
-
|
|
24
|
-
export { default as builtinsTree } from "./builtinsTree.js";
|
package/src/js.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
async function fetchWrapper(resource, options) {
|
|
2
|
-
const response = await fetch(resource, options);
|
|
3
|
-
return response.ok ? await response.arrayBuffer() : undefined;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
Array,
|
|
8
|
-
BigInt,
|
|
9
|
-
Boolean,
|
|
10
|
-
Date,
|
|
11
|
-
Error,
|
|
12
|
-
Infinity,
|
|
13
|
-
Intl,
|
|
14
|
-
JSON,
|
|
15
|
-
Map,
|
|
16
|
-
Math,
|
|
17
|
-
NaN,
|
|
18
|
-
Number,
|
|
19
|
-
Object,
|
|
20
|
-
RegExp,
|
|
21
|
-
Response,
|
|
22
|
-
Set,
|
|
23
|
-
String,
|
|
24
|
-
Symbol,
|
|
25
|
-
decodeURI,
|
|
26
|
-
decodeURIComponent,
|
|
27
|
-
encodeURI,
|
|
28
|
-
encodeURIComponent,
|
|
29
|
-
false: false,
|
|
30
|
-
fetch: fetchWrapper,
|
|
31
|
-
isFinite,
|
|
32
|
-
isNaN,
|
|
33
|
-
null: null,
|
|
34
|
-
parseFloat,
|
|
35
|
-
parseInt,
|
|
36
|
-
true: true,
|
|
37
|
-
undefined: undefined,
|
|
38
|
-
};
|
package/src/node.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
import url from "node:url";
|
|
4
|
-
|
|
5
|
-
// Patch process.env to be a plain object. Among other things, this lets us dump
|
|
6
|
-
// the complete environment to the terminal with `ori @node/process/env`.
|
|
7
|
-
const patchedProcess = Object.create(null, {
|
|
8
|
-
...Object.getOwnPropertyDescriptors(process),
|
|
9
|
-
env: {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return Object.assign({}, process.env);
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
Buffer,
|
|
19
|
-
path,
|
|
20
|
-
process: patchedProcess,
|
|
21
|
-
url,
|
|
22
|
-
};
|