@b9g/crank 0.4.4 → 0.5.0-beta.1
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/README.md +15 -50
- package/crank.cjs +24 -6
- package/crank.cjs.map +1 -1
- package/crank.d.ts +1 -3
- package/crank.js +24 -6
- package/crank.js.map +1 -1
- package/index.cjs +2 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/package.json +24 -16
- package/umd.js +24 -6
- package/umd.js.map +1 -1
- package/xm.cjs +431 -0
- package/xm.cjs.map +1 -0
- package/xm.d.ts +2 -0
- package/xm.js +428 -0
- package/xm.js.map +1 -0
package/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var crank = require('./crank.cjs');
|
|
6
|
+
var xm = require('./xm.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -15,6 +16,6 @@ exports.Raw = crank.Raw;
|
|
|
15
16
|
exports.Renderer = crank.Renderer;
|
|
16
17
|
exports.cloneElement = crank.cloneElement;
|
|
17
18
|
exports.createElement = crank.createElement;
|
|
18
|
-
exports["default"] = crank["default"];
|
|
19
19
|
exports.isElement = crank.isElement;
|
|
20
|
+
exports.xm = xm.xm;
|
|
20
21
|
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./crank.js";
|
|
2
|
-
export {
|
|
2
|
+
export { xm } from "./xm.js";
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="index.d.ts" />
|
|
2
|
-
export { Context, Copy, Element, Fragment, Portal, Raw, Renderer, cloneElement, createElement,
|
|
2
|
+
export { Context, Copy, Element, Fragment, Portal, Raw, Renderer, cloneElement, createElement, isElement } from './crank.js';
|
|
3
|
+
export { xm } from './xm.js';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b9g/crank",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-beta.1",
|
|
4
4
|
"description": "Write JSX-driven components with functions, promises and generators.",
|
|
5
5
|
"homepage": "https://crank.js.org",
|
|
6
6
|
"bugs": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"import": "./
|
|
18
|
-
"require": "./
|
|
17
|
+
"import": "./index.js",
|
|
18
|
+
"require": "./index.cjs"
|
|
19
19
|
},
|
|
20
20
|
"./crank": {
|
|
21
21
|
"import": "./crank.js",
|
|
@@ -50,6 +50,14 @@
|
|
|
50
50
|
"require": "./index.cjs"
|
|
51
51
|
},
|
|
52
52
|
"./package.json": "./package.json",
|
|
53
|
+
"./xm": {
|
|
54
|
+
"import": "./xm.js",
|
|
55
|
+
"require": "./xm.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./xm.js": {
|
|
58
|
+
"import": "./xm.js",
|
|
59
|
+
"require": "./xm.cjs"
|
|
60
|
+
},
|
|
53
61
|
"./umd": {
|
|
54
62
|
"require": "./umd.js"
|
|
55
63
|
},
|
|
@@ -57,28 +65,28 @@
|
|
|
57
65
|
"require": "./umd.js"
|
|
58
66
|
}
|
|
59
67
|
},
|
|
60
|
-
"main": "
|
|
61
|
-
"module": "
|
|
62
|
-
"types": "
|
|
68
|
+
"main": "index.cjs",
|
|
69
|
+
"module": "index.js",
|
|
70
|
+
"types": "index.d.ts",
|
|
63
71
|
"devDependencies": {
|
|
64
72
|
"@arkweid/lefthook": "^0.7.7",
|
|
65
|
-
"@types/
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
67
|
-
"@typescript-eslint/parser": "^5.
|
|
68
|
-
"eslint": "^8.
|
|
73
|
+
"@types/sinon": "^10.0.12",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
75
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
76
|
+
"eslint": "^8.19.0",
|
|
69
77
|
"eslint-config-prettier": "^8.5.0",
|
|
70
|
-
"eslint-plugin-jest": "^24.4.2",
|
|
71
78
|
"eslint-plugin-prettier": "^4.2.1",
|
|
72
79
|
"eslint-plugin-react": "^7.30.1",
|
|
73
|
-
"jest": "^26.6.3",
|
|
74
80
|
"magic-string": "^0.26.2",
|
|
81
|
+
"playwright-test": "^8.1.1",
|
|
75
82
|
"prettier": "^2.7.1",
|
|
76
|
-
"rollup": "^2.
|
|
83
|
+
"rollup": "^2.76.0",
|
|
77
84
|
"rollup-plugin-typescript2": "^0.32.1",
|
|
78
85
|
"shx": "^0.3.4",
|
|
79
|
-
"
|
|
80
|
-
"ts-
|
|
81
|
-
"typescript": "^4.7.4"
|
|
86
|
+
"sinon": "^14.0.0",
|
|
87
|
+
"ts-node": "^10.9.0",
|
|
88
|
+
"typescript": "^4.7.4",
|
|
89
|
+
"uvu": "^0.5.6"
|
|
82
90
|
},
|
|
83
91
|
"publishConfig": {
|
|
84
92
|
"access": "public"
|
package/umd.js
CHANGED
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
this.static_ = static_;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
+
// See Element interface
|
|
113
114
|
Element.prototype.$$typeof = ElementSymbol;
|
|
114
115
|
function isElement(value) {
|
|
115
116
|
return value != null && value.$$typeof === ElementSymbol;
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
switch (name) {
|
|
133
134
|
case "crank-key":
|
|
134
135
|
case "c-key":
|
|
136
|
+
case "$key":
|
|
135
137
|
// We have to make sure we don’t assign null to the key because we
|
|
136
138
|
// don’t check for null keys in the diffing functions.
|
|
137
139
|
if (props[name] != null) {
|
|
@@ -140,12 +142,14 @@
|
|
|
140
142
|
break;
|
|
141
143
|
case "crank-ref":
|
|
142
144
|
case "c-ref":
|
|
145
|
+
case "$ref":
|
|
143
146
|
if (typeof props[name] === "function") {
|
|
144
147
|
ref = props[name];
|
|
145
148
|
}
|
|
146
149
|
break;
|
|
147
150
|
case "crank-static":
|
|
148
151
|
case "c-static":
|
|
152
|
+
case "$static":
|
|
149
153
|
static_ = !!props[name];
|
|
150
154
|
break;
|
|
151
155
|
default:
|
|
@@ -159,11 +163,25 @@
|
|
|
159
163
|
else if (children.length === 1) {
|
|
160
164
|
props1.children = children[0];
|
|
161
165
|
}
|
|
166
|
+
// string aliases for the special tags
|
|
167
|
+
// TODO: Does this logic belong here, or in the Element constructor
|
|
168
|
+
switch (tag) {
|
|
169
|
+
case "$FRAGMENT":
|
|
170
|
+
tag = Fragment;
|
|
171
|
+
break;
|
|
172
|
+
case "$PORTAL":
|
|
173
|
+
tag = Portal;
|
|
174
|
+
break;
|
|
175
|
+
case "$COPY":
|
|
176
|
+
tag = Copy;
|
|
177
|
+
break;
|
|
178
|
+
case "$RAW":
|
|
179
|
+
tag = Raw;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
162
182
|
return new Element(tag, props1, key, ref, static_);
|
|
163
183
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Clones a given element, shallowly copying the props object.
|
|
166
|
-
*/
|
|
184
|
+
/** Clones a given element, shallowly copying the props object. */
|
|
167
185
|
function cloneElement(el) {
|
|
168
186
|
if (!isElement(el)) {
|
|
169
187
|
throw new TypeError("Cannot clone non-element");
|
|
@@ -737,9 +755,9 @@
|
|
|
737
755
|
*
|
|
738
756
|
* NOTE: This is mainly used to prevent some false positives in component
|
|
739
757
|
* yields or returns undefined warnings. The reason we’re using this versus
|
|
740
|
-
* IsUnmounted is a very troubling
|
|
741
|
-
*
|
|
742
|
-
*
|
|
758
|
+
* IsUnmounted is a very troubling test (cascades sync generator parent and
|
|
759
|
+
* sync generator child) where synchronous code causes a stack overflow error
|
|
760
|
+
* in a non-deterministic way. Deeply disturbing stuff.
|
|
743
761
|
*/
|
|
744
762
|
const IsErrored = 1 << 5;
|
|
745
763
|
/**
|