ru.Bee 1.3.3 → 1.5.0
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.
- checksums.yaml +4 -4
- data/bin/rubee +36 -4
- data/lib/app/views/app.tsx +27 -0
- data/lib/app/views/apples_.erb +1 -0
- data/lib/app/views/index.html +47 -0
- data/lib/app/views/layout.erb +3 -3
- data/lib/app/views/utils/redirectToBackend.tsx +9 -0
- data/lib/app/views/welcome_show.erb +1 -1
- data/lib/config/base_configuration.rb +9 -0
- data/lib/config/routes.rb +1 -0
- data/lib/esbuild.config.js +33 -0
- data/lib/js/app.js +13 -0
- data/lib/js/app.js.map +7 -0
- data/lib/js/bundle.js +26157 -0
- data/lib/js/bundle.js.map +7 -0
- data/lib/node_modules/@types/cookie/LICENSE +21 -0
- data/lib/node_modules/@types/cookie/README.md +15 -0
- data/lib/node_modules/@types/cookie/index.d.ts +154 -0
- data/lib/node_modules/@types/cookie/package.json +30 -0
- data/lib/node_modules/cookie/LICENSE +24 -0
- data/lib/node_modules/cookie/README.md +248 -0
- data/lib/node_modules/cookie/dist/index.d.ts +114 -0
- data/lib/node_modules/cookie/dist/index.js +239 -0
- data/lib/node_modules/cookie/dist/index.js.map +1 -0
- data/lib/node_modules/cookie/package.json +42 -0
- data/lib/node_modules/js-tokens/CHANGELOG.md +151 -0
- data/lib/node_modules/js-tokens/LICENSE +21 -0
- data/lib/node_modules/js-tokens/README.md +240 -0
- data/lib/node_modules/js-tokens/index.js +23 -0
- data/lib/node_modules/js-tokens/package.json +30 -0
- data/lib/node_modules/loose-envify/LICENSE +21 -0
- data/lib/node_modules/loose-envify/README.md +45 -0
- data/lib/node_modules/loose-envify/cli.js +16 -0
- data/lib/node_modules/loose-envify/custom.js +4 -0
- data/lib/node_modules/loose-envify/index.js +3 -0
- data/lib/node_modules/loose-envify/loose-envify.js +36 -0
- data/lib/node_modules/loose-envify/package.json +36 -0
- data/lib/node_modules/loose-envify/replace.js +65 -0
- data/lib/node_modules/react/LICENSE +21 -0
- data/lib/node_modules/react/README.md +37 -0
- data/lib/node_modules/react/cjs/react-jsx-dev-runtime.development.js +1315 -0
- data/lib/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +10 -0
- data/lib/node_modules/react/cjs/react-jsx-dev-runtime.profiling.min.js +10 -0
- data/lib/node_modules/react/cjs/react-jsx-runtime.development.js +1333 -0
- data/lib/node_modules/react/cjs/react-jsx-runtime.production.min.js +11 -0
- data/lib/node_modules/react/cjs/react-jsx-runtime.profiling.min.js +11 -0
- data/lib/node_modules/react/cjs/react.development.js +2740 -0
- data/lib/node_modules/react/cjs/react.production.min.js +26 -0
- data/lib/node_modules/react/cjs/react.shared-subset.development.js +20 -0
- data/lib/node_modules/react/cjs/react.shared-subset.production.min.js +10 -0
- data/lib/node_modules/react/index.js +7 -0
- data/lib/node_modules/react/jsx-dev-runtime.js +7 -0
- data/lib/node_modules/react/jsx-runtime.js +7 -0
- data/lib/node_modules/react/package.json +47 -0
- data/lib/node_modules/react/react.shared-subset.js +7 -0
- data/lib/node_modules/react/umd/react.development.js +3343 -0
- data/lib/node_modules/react/umd/react.production.min.js +31 -0
- data/lib/node_modules/react/umd/react.profiling.min.js +31 -0
- data/lib/node_modules/react-dom/LICENSE +21 -0
- data/lib/node_modules/react-dom/README.md +60 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +7029 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js +93 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.js +7093 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js +101 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server.browser.development.js +7014 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +96 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server.node.development.js +7070 -0
- data/lib/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +102 -0
- data/lib/node_modules/react-dom/cjs/react-dom-test-utils.development.js +1763 -0
- data/lib/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +40 -0
- data/lib/node_modules/react-dom/cjs/react-dom.development.js +29923 -0
- data/lib/node_modules/react-dom/cjs/react-dom.production.min.js +322 -0
- data/lib/node_modules/react-dom/cjs/react-dom.profiling.min.js +366 -0
- data/lib/node_modules/react-dom/client.js +25 -0
- data/lib/node_modules/react-dom/index.js +38 -0
- data/lib/node_modules/react-dom/package.json +62 -0
- data/lib/node_modules/react-dom/profiling.js +38 -0
- data/lib/node_modules/react-dom/server.browser.js +17 -0
- data/lib/node_modules/react-dom/server.js +3 -0
- data/lib/node_modules/react-dom/server.node.js +17 -0
- data/lib/node_modules/react-dom/test-utils.js +7 -0
- data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.development.js +7026 -0
- data/lib/node_modules/react-dom/umd/react-dom-server-legacy.browser.production.min.js +75 -0
- data/lib/node_modules/react-dom/umd/react-dom-server.browser.development.js +7011 -0
- data/lib/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +76 -0
- data/lib/node_modules/react-dom/umd/react-dom-test-utils.development.js +1759 -0
- data/lib/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +33 -0
- data/lib/node_modules/react-dom/umd/react-dom.development.js +29924 -0
- data/lib/node_modules/react-dom/umd/react-dom.production.min.js +267 -0
- data/lib/node_modules/react-dom/umd/react-dom.profiling.min.js +285 -0
- data/lib/node_modules/react-router/CHANGELOG.md +1526 -0
- data/lib/node_modules/react-router/LICENSE.md +23 -0
- data/lib/node_modules/react-router/README.md +7 -0
- data/lib/node_modules/react-router/dist/development/chunk-KNED5TY2.mjs +10476 -0
- data/lib/node_modules/react-router/dist/development/dom-export.d.mts +23 -0
- data/lib/node_modules/react-router/dist/development/dom-export.d.ts +23 -0
- data/lib/node_modules/react-router/dist/development/dom-export.js +6111 -0
- data/lib/node_modules/react-router/dist/development/dom-export.mjs +234 -0
- data/lib/node_modules/react-router/dist/development/fog-of-war-1hWhK5ey.d.mts +1690 -0
- data/lib/node_modules/react-router/dist/development/fog-of-war-oa9CGk10.d.ts +1690 -0
- data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.mts +21 -0
- data/lib/node_modules/react-router/dist/development/future-ldDp5FKH.d.ts +21 -0
- data/lib/node_modules/react-router/dist/development/index.d.mts +841 -0
- data/lib/node_modules/react-router/dist/development/index.d.ts +841 -0
- data/lib/node_modules/react-router/dist/development/index.js +10624 -0
- data/lib/node_modules/react-router/dist/development/index.mjs +242 -0
- data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.mts +209 -0
- data/lib/node_modules/react-router/dist/development/lib/types/route-module.d.ts +209 -0
- data/lib/node_modules/react-router/dist/development/lib/types/route-module.js +28 -0
- data/lib/node_modules/react-router/dist/development/lib/types/route-module.mjs +10 -0
- data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.mts +1716 -0
- data/lib/node_modules/react-router/dist/development/route-data-5OzAzQtT.d.ts +1716 -0
- data/lib/node_modules/react-router/dist/production/chunk-ZIM7OIE3.mjs +10476 -0
- data/lib/node_modules/react-router/dist/production/dom-export.d.mts +23 -0
- data/lib/node_modules/react-router/dist/production/dom-export.d.ts +23 -0
- data/lib/node_modules/react-router/dist/production/dom-export.js +6111 -0
- data/lib/node_modules/react-router/dist/production/dom-export.mjs +234 -0
- data/lib/node_modules/react-router/dist/production/fog-of-war-1hWhK5ey.d.mts +1690 -0
- data/lib/node_modules/react-router/dist/production/fog-of-war-oa9CGk10.d.ts +1690 -0
- data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.mts +21 -0
- data/lib/node_modules/react-router/dist/production/future-ldDp5FKH.d.ts +21 -0
- data/lib/node_modules/react-router/dist/production/index.d.mts +841 -0
- data/lib/node_modules/react-router/dist/production/index.d.ts +841 -0
- data/lib/node_modules/react-router/dist/production/index.js +10624 -0
- data/lib/node_modules/react-router/dist/production/index.mjs +242 -0
- data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.mts +209 -0
- data/lib/node_modules/react-router/dist/production/lib/types/route-module.d.ts +209 -0
- data/lib/node_modules/react-router/dist/production/lib/types/route-module.js +28 -0
- data/lib/node_modules/react-router/dist/production/lib/types/route-module.mjs +10 -0
- data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.mts +1716 -0
- data/lib/node_modules/react-router/dist/production/route-data-5OzAzQtT.d.ts +1716 -0
- data/lib/node_modules/react-router/package.json +116 -0
- data/lib/node_modules/react-router-dom/LICENSE.md +23 -0
- data/lib/node_modules/react-router-dom/README.md +6 -0
- data/lib/node_modules/react-router-dom/dist/index.d.mts +2 -0
- data/lib/node_modules/react-router-dom/dist/index.d.ts +2 -0
- data/lib/node_modules/react-router-dom/dist/index.js +45 -0
- data/lib/node_modules/react-router-dom/dist/index.mjs +18 -0
- data/lib/node_modules/react-router-dom/package.json +82 -0
- data/lib/node_modules/scheduler/LICENSE +21 -0
- data/lib/node_modules/scheduler/README.md +9 -0
- data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +700 -0
- data/lib/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +20 -0
- data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.development.js +207 -0
- data/lib/node_modules/scheduler/cjs/scheduler-unstable_post_task.production.min.js +14 -0
- data/lib/node_modules/scheduler/cjs/scheduler.development.js +634 -0
- data/lib/node_modules/scheduler/cjs/scheduler.production.min.js +19 -0
- data/lib/node_modules/scheduler/index.js +7 -0
- data/lib/node_modules/scheduler/package.json +36 -0
- data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +699 -0
- data/lib/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +19 -0
- data/lib/node_modules/scheduler/umd/scheduler.development.js +152 -0
- data/lib/node_modules/scheduler/umd/scheduler.production.min.js +146 -0
- data/lib/node_modules/scheduler/umd/scheduler.profiling.min.js +146 -0
- data/lib/node_modules/scheduler/unstable_mock.js +7 -0
- data/lib/node_modules/scheduler/unstable_post_task.js +7 -0
- data/lib/node_modules/set-cookie-parser/LICENSE +21 -0
- data/lib/node_modules/set-cookie-parser/README.md +202 -0
- data/lib/node_modules/set-cookie-parser/lib/set-cookie.js +224 -0
- data/lib/node_modules/set-cookie-parser/package.json +45 -0
- data/lib/node_modules/turbo-stream/LICENSE +7 -0
- data/lib/node_modules/turbo-stream/README.md +31 -0
- data/lib/node_modules/turbo-stream/dist/flatten.d.ts +2 -0
- data/lib/node_modules/turbo-stream/dist/flatten.js +203 -0
- data/lib/node_modules/turbo-stream/dist/turbo-stream.d.ts +13 -0
- data/lib/node_modules/turbo-stream/dist/turbo-stream.js +207 -0
- data/lib/node_modules/turbo-stream/dist/turbo-stream.mjs +673 -0
- data/lib/node_modules/turbo-stream/dist/unflatten.d.ts +2 -0
- data/lib/node_modules/turbo-stream/dist/unflatten.js +243 -0
- data/lib/node_modules/turbo-stream/dist/utils.d.ts +44 -0
- data/lib/node_modules/turbo-stream/dist/utils.js +55 -0
- data/lib/node_modules/turbo-stream/package.json +50 -0
- data/lib/package-lock.json +133 -0
- data/lib/package.json +12 -0
- data/lib/rubee/controllers/base_controller.rb +14 -0
- data/lib/rubee.rb +100 -21
- data/lib/tests/rubee_generator_test.rb +190 -0
- data/lib/tests/rubeeapp_test.rb +12 -0
- data/lib/tests/test.db +0 -0
- data/lib/tests/user_model_test.rb +5 -0
- data/readme.md +288 -64
- metadata +172 -3
@@ -0,0 +1,243 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.unflatten = void 0;
|
4
|
+
const utils_js_1 = require("./utils.js");
|
5
|
+
const globalObj = (typeof window !== "undefined"
|
6
|
+
? window
|
7
|
+
: typeof globalThis !== "undefined"
|
8
|
+
? globalThis
|
9
|
+
: undefined);
|
10
|
+
function unflatten(parsed) {
|
11
|
+
const { hydrated, values } = this;
|
12
|
+
if (typeof parsed === "number")
|
13
|
+
return hydrate.call(this, parsed);
|
14
|
+
if (!Array.isArray(parsed) || !parsed.length)
|
15
|
+
throw new SyntaxError();
|
16
|
+
const startIndex = values.length;
|
17
|
+
for (const value of parsed) {
|
18
|
+
values.push(value);
|
19
|
+
}
|
20
|
+
hydrated.length = values.length;
|
21
|
+
return hydrate.call(this, startIndex);
|
22
|
+
}
|
23
|
+
exports.unflatten = unflatten;
|
24
|
+
function hydrate(index) {
|
25
|
+
const { hydrated, values, deferred, plugins } = this;
|
26
|
+
let result;
|
27
|
+
const stack = [
|
28
|
+
[
|
29
|
+
index,
|
30
|
+
(v) => {
|
31
|
+
result = v;
|
32
|
+
},
|
33
|
+
],
|
34
|
+
];
|
35
|
+
let postRun = [];
|
36
|
+
while (stack.length > 0) {
|
37
|
+
const [index, set] = stack.pop();
|
38
|
+
switch (index) {
|
39
|
+
case utils_js_1.UNDEFINED:
|
40
|
+
set(undefined);
|
41
|
+
continue;
|
42
|
+
case utils_js_1.NULL:
|
43
|
+
set(null);
|
44
|
+
continue;
|
45
|
+
case utils_js_1.NAN:
|
46
|
+
set(NaN);
|
47
|
+
continue;
|
48
|
+
case utils_js_1.POSITIVE_INFINITY:
|
49
|
+
set(Infinity);
|
50
|
+
continue;
|
51
|
+
case utils_js_1.NEGATIVE_INFINITY:
|
52
|
+
set(-Infinity);
|
53
|
+
continue;
|
54
|
+
case utils_js_1.NEGATIVE_ZERO:
|
55
|
+
set(-0);
|
56
|
+
continue;
|
57
|
+
}
|
58
|
+
if (hydrated[index]) {
|
59
|
+
set(hydrated[index]);
|
60
|
+
continue;
|
61
|
+
}
|
62
|
+
const value = values[index];
|
63
|
+
if (!value || typeof value !== "object") {
|
64
|
+
hydrated[index] = value;
|
65
|
+
set(value);
|
66
|
+
continue;
|
67
|
+
}
|
68
|
+
if (Array.isArray(value)) {
|
69
|
+
if (typeof value[0] === "string") {
|
70
|
+
const [type, b, c] = value;
|
71
|
+
switch (type) {
|
72
|
+
case utils_js_1.TYPE_DATE:
|
73
|
+
set((hydrated[index] = new Date(b)));
|
74
|
+
continue;
|
75
|
+
case utils_js_1.TYPE_URL:
|
76
|
+
set((hydrated[index] = new URL(b)));
|
77
|
+
continue;
|
78
|
+
case utils_js_1.TYPE_BIGINT:
|
79
|
+
set((hydrated[index] = BigInt(b)));
|
80
|
+
continue;
|
81
|
+
case utils_js_1.TYPE_REGEXP:
|
82
|
+
set((hydrated[index] = new RegExp(b, c)));
|
83
|
+
continue;
|
84
|
+
case utils_js_1.TYPE_SYMBOL:
|
85
|
+
set((hydrated[index] = Symbol.for(b)));
|
86
|
+
continue;
|
87
|
+
case utils_js_1.TYPE_SET:
|
88
|
+
const newSet = new Set();
|
89
|
+
hydrated[index] = newSet;
|
90
|
+
for (let i = 1; i < value.length; i++)
|
91
|
+
stack.push([
|
92
|
+
value[i],
|
93
|
+
(v) => {
|
94
|
+
newSet.add(v);
|
95
|
+
},
|
96
|
+
]);
|
97
|
+
set(newSet);
|
98
|
+
continue;
|
99
|
+
case utils_js_1.TYPE_MAP:
|
100
|
+
const map = new Map();
|
101
|
+
hydrated[index] = map;
|
102
|
+
for (let i = 1; i < value.length; i += 2) {
|
103
|
+
const r = [];
|
104
|
+
stack.push([
|
105
|
+
value[i + 1],
|
106
|
+
(v) => {
|
107
|
+
r[1] = v;
|
108
|
+
},
|
109
|
+
]);
|
110
|
+
stack.push([
|
111
|
+
value[i],
|
112
|
+
(k) => {
|
113
|
+
r[0] = k;
|
114
|
+
},
|
115
|
+
]);
|
116
|
+
postRun.push(() => {
|
117
|
+
map.set(r[0], r[1]);
|
118
|
+
});
|
119
|
+
}
|
120
|
+
set(map);
|
121
|
+
continue;
|
122
|
+
case utils_js_1.TYPE_NULL_OBJECT:
|
123
|
+
const obj = Object.create(null);
|
124
|
+
hydrated[index] = obj;
|
125
|
+
for (const key of Object.keys(b).reverse()) {
|
126
|
+
const r = [];
|
127
|
+
stack.push([
|
128
|
+
b[key],
|
129
|
+
(v) => {
|
130
|
+
r[1] = v;
|
131
|
+
},
|
132
|
+
]);
|
133
|
+
stack.push([
|
134
|
+
Number(key.slice(1)),
|
135
|
+
(k) => {
|
136
|
+
r[0] = k;
|
137
|
+
},
|
138
|
+
]);
|
139
|
+
postRun.push(() => {
|
140
|
+
obj[r[0]] = r[1];
|
141
|
+
});
|
142
|
+
}
|
143
|
+
set(obj);
|
144
|
+
continue;
|
145
|
+
case utils_js_1.TYPE_PROMISE:
|
146
|
+
if (hydrated[b]) {
|
147
|
+
set((hydrated[index] = hydrated[b]));
|
148
|
+
}
|
149
|
+
else {
|
150
|
+
const d = new utils_js_1.Deferred();
|
151
|
+
deferred[b] = d;
|
152
|
+
set((hydrated[index] = d.promise));
|
153
|
+
}
|
154
|
+
continue;
|
155
|
+
case utils_js_1.TYPE_ERROR:
|
156
|
+
const [, message, errorType] = value;
|
157
|
+
let error = errorType && globalObj && globalObj[errorType]
|
158
|
+
? new globalObj[errorType](message)
|
159
|
+
: new Error(message);
|
160
|
+
hydrated[index] = error;
|
161
|
+
set(error);
|
162
|
+
continue;
|
163
|
+
case utils_js_1.TYPE_PREVIOUS_RESOLVED:
|
164
|
+
set((hydrated[index] = hydrated[b]));
|
165
|
+
continue;
|
166
|
+
default:
|
167
|
+
// Run plugins at the end so we have a chance to resolve primitives
|
168
|
+
// without running into a loop
|
169
|
+
if (Array.isArray(plugins)) {
|
170
|
+
const r = [];
|
171
|
+
const vals = value.slice(1);
|
172
|
+
for (let i = 0; i < vals.length; i++) {
|
173
|
+
const v = vals[i];
|
174
|
+
stack.push([
|
175
|
+
v,
|
176
|
+
(v) => {
|
177
|
+
r[i] = v;
|
178
|
+
},
|
179
|
+
]);
|
180
|
+
}
|
181
|
+
postRun.push(() => {
|
182
|
+
for (const plugin of plugins) {
|
183
|
+
const result = plugin(value[0], ...r);
|
184
|
+
if (result) {
|
185
|
+
set((hydrated[index] = result.value));
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
throw new SyntaxError();
|
190
|
+
});
|
191
|
+
continue;
|
192
|
+
}
|
193
|
+
throw new SyntaxError();
|
194
|
+
}
|
195
|
+
}
|
196
|
+
else {
|
197
|
+
const array = [];
|
198
|
+
hydrated[index] = array;
|
199
|
+
for (let i = 0; i < value.length; i++) {
|
200
|
+
const n = value[i];
|
201
|
+
if (n !== utils_js_1.HOLE) {
|
202
|
+
stack.push([
|
203
|
+
n,
|
204
|
+
(v) => {
|
205
|
+
array[i] = v;
|
206
|
+
},
|
207
|
+
]);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
set(array);
|
211
|
+
continue;
|
212
|
+
}
|
213
|
+
}
|
214
|
+
else {
|
215
|
+
const object = {};
|
216
|
+
hydrated[index] = object;
|
217
|
+
for (const key of Object.keys(value).reverse()) {
|
218
|
+
const r = [];
|
219
|
+
stack.push([
|
220
|
+
value[key],
|
221
|
+
(v) => {
|
222
|
+
r[1] = v;
|
223
|
+
},
|
224
|
+
]);
|
225
|
+
stack.push([
|
226
|
+
Number(key.slice(1)),
|
227
|
+
(k) => {
|
228
|
+
r[0] = k;
|
229
|
+
},
|
230
|
+
]);
|
231
|
+
postRun.push(() => {
|
232
|
+
object[r[0]] = r[1];
|
233
|
+
});
|
234
|
+
}
|
235
|
+
set(object);
|
236
|
+
continue;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
while (postRun.length > 0) {
|
240
|
+
postRun.pop()();
|
241
|
+
}
|
242
|
+
return result;
|
243
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
export declare const HOLE = -1;
|
2
|
+
export declare const NAN = -2;
|
3
|
+
export declare const NEGATIVE_INFINITY = -3;
|
4
|
+
export declare const NEGATIVE_ZERO = -4;
|
5
|
+
export declare const NULL = -5;
|
6
|
+
export declare const POSITIVE_INFINITY = -6;
|
7
|
+
export declare const UNDEFINED = -7;
|
8
|
+
export declare const TYPE_BIGINT = "B";
|
9
|
+
export declare const TYPE_DATE = "D";
|
10
|
+
export declare const TYPE_ERROR = "E";
|
11
|
+
export declare const TYPE_MAP = "M";
|
12
|
+
export declare const TYPE_NULL_OBJECT = "N";
|
13
|
+
export declare const TYPE_PROMISE = "P";
|
14
|
+
export declare const TYPE_REGEXP = "R";
|
15
|
+
export declare const TYPE_SET = "S";
|
16
|
+
export declare const TYPE_SYMBOL = "Y";
|
17
|
+
export declare const TYPE_URL = "U";
|
18
|
+
export declare const TYPE_PREVIOUS_RESOLVED = "Z";
|
19
|
+
export type DecodePlugin = (type: string, ...data: unknown[]) => {
|
20
|
+
value: unknown;
|
21
|
+
} | false | null | undefined;
|
22
|
+
export type EncodePlugin = (value: unknown) => [string, ...unknown[]] | false | null | undefined;
|
23
|
+
export interface ThisDecode {
|
24
|
+
values: unknown[];
|
25
|
+
hydrated: unknown[];
|
26
|
+
deferred: Record<number, Deferred<unknown>>;
|
27
|
+
plugins?: DecodePlugin[];
|
28
|
+
}
|
29
|
+
export interface ThisEncode {
|
30
|
+
index: number;
|
31
|
+
indices: Map<unknown, number>;
|
32
|
+
stringified: string[];
|
33
|
+
deferred: Record<number, Promise<unknown>>;
|
34
|
+
plugins?: EncodePlugin[];
|
35
|
+
postPlugins?: EncodePlugin[];
|
36
|
+
signal?: AbortSignal;
|
37
|
+
}
|
38
|
+
export declare class Deferred<T = unknown> {
|
39
|
+
promise: Promise<T>;
|
40
|
+
resolve: (value: T) => void;
|
41
|
+
reject: (reason: unknown) => void;
|
42
|
+
constructor();
|
43
|
+
}
|
44
|
+
export declare function createLineSplittingTransform(): TransformStream<any, any>;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createLineSplittingTransform = exports.Deferred = exports.TYPE_PREVIOUS_RESOLVED = exports.TYPE_URL = exports.TYPE_SYMBOL = exports.TYPE_SET = exports.TYPE_REGEXP = exports.TYPE_PROMISE = exports.TYPE_NULL_OBJECT = exports.TYPE_MAP = exports.TYPE_ERROR = exports.TYPE_DATE = exports.TYPE_BIGINT = exports.UNDEFINED = exports.POSITIVE_INFINITY = exports.NULL = exports.NEGATIVE_ZERO = exports.NEGATIVE_INFINITY = exports.NAN = exports.HOLE = void 0;
|
4
|
+
exports.HOLE = -1;
|
5
|
+
exports.NAN = -2;
|
6
|
+
exports.NEGATIVE_INFINITY = -3;
|
7
|
+
exports.NEGATIVE_ZERO = -4;
|
8
|
+
exports.NULL = -5;
|
9
|
+
exports.POSITIVE_INFINITY = -6;
|
10
|
+
exports.UNDEFINED = -7;
|
11
|
+
exports.TYPE_BIGINT = "B";
|
12
|
+
exports.TYPE_DATE = "D";
|
13
|
+
exports.TYPE_ERROR = "E";
|
14
|
+
exports.TYPE_MAP = "M";
|
15
|
+
exports.TYPE_NULL_OBJECT = "N";
|
16
|
+
exports.TYPE_PROMISE = "P";
|
17
|
+
exports.TYPE_REGEXP = "R";
|
18
|
+
exports.TYPE_SET = "S";
|
19
|
+
exports.TYPE_SYMBOL = "Y";
|
20
|
+
exports.TYPE_URL = "U";
|
21
|
+
exports.TYPE_PREVIOUS_RESOLVED = "Z";
|
22
|
+
class Deferred {
|
23
|
+
promise;
|
24
|
+
resolve;
|
25
|
+
reject;
|
26
|
+
constructor() {
|
27
|
+
this.promise = new Promise((resolve, reject) => {
|
28
|
+
this.resolve = resolve;
|
29
|
+
this.reject = reject;
|
30
|
+
});
|
31
|
+
}
|
32
|
+
}
|
33
|
+
exports.Deferred = Deferred;
|
34
|
+
function createLineSplittingTransform() {
|
35
|
+
const decoder = new TextDecoder();
|
36
|
+
let leftover = "";
|
37
|
+
return new TransformStream({
|
38
|
+
transform(chunk, controller) {
|
39
|
+
const str = decoder.decode(chunk, { stream: true });
|
40
|
+
const parts = (leftover + str).split("\n");
|
41
|
+
// The last part might be a partial line, so keep it for the next chunk.
|
42
|
+
leftover = parts.pop() || "";
|
43
|
+
for (const part of parts) {
|
44
|
+
controller.enqueue(part);
|
45
|
+
}
|
46
|
+
},
|
47
|
+
flush(controller) {
|
48
|
+
// If there's any leftover data, enqueue it before closing.
|
49
|
+
if (leftover) {
|
50
|
+
controller.enqueue(leftover);
|
51
|
+
}
|
52
|
+
},
|
53
|
+
});
|
54
|
+
}
|
55
|
+
exports.createLineSplittingTransform = createLineSplittingTransform;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
{
|
2
|
+
"name": "turbo-stream",
|
3
|
+
"version": "2.4.0",
|
4
|
+
"description": "A streaming data transport format that aims to support built-in features such as Promises, Dates, RegExps, Maps, Sets and more.",
|
5
|
+
"files": [
|
6
|
+
"dist",
|
7
|
+
"README.md"
|
8
|
+
],
|
9
|
+
"main": "dist/turbo-stream.js",
|
10
|
+
"types": "dist/turbo-stream.d.ts",
|
11
|
+
"exports": {
|
12
|
+
".": {
|
13
|
+
"types": "./dist/turbo-stream.d.ts",
|
14
|
+
"import": "./dist/turbo-stream.mjs",
|
15
|
+
"require": "./dist/turbo-stream.js",
|
16
|
+
"default": "./dist/turbo-stream.js"
|
17
|
+
},
|
18
|
+
"./package.json": "./package.json"
|
19
|
+
},
|
20
|
+
"scripts": {
|
21
|
+
"build": "pnpm build:esm && pnpm build:cjs && cp ./dist/turbo-stream.mjs ./viewer/scripts/turbo-stream.js",
|
22
|
+
"build:cjs": "tsc --outDir dist --project tsconfig.lib.json",
|
23
|
+
"build:esm": "esbuild --bundle --platform=node --target=node16 --format=esm --outfile=dist/turbo-stream.mjs src/turbo-stream.ts",
|
24
|
+
"test": "node --no-warnings --loader tsm --enable-source-maps --test-reporter tap --test src/*.spec.ts",
|
25
|
+
"test-typecheck": "tsc --noEmit --project tsconfig.spec.json",
|
26
|
+
"prepublish": "attw $(npm pack) --ignore-rules false-cjs"
|
27
|
+
},
|
28
|
+
"keywords": [
|
29
|
+
"devalue",
|
30
|
+
"turbo",
|
31
|
+
"stream",
|
32
|
+
"enhanced",
|
33
|
+
"json"
|
34
|
+
],
|
35
|
+
"author": "Jacob Ebey <jacob.ebey@live.com>",
|
36
|
+
"license": "ISC",
|
37
|
+
"repository": {
|
38
|
+
"type": "git",
|
39
|
+
"url": "https://github.com/jacob-ebey/turbo-stream.git"
|
40
|
+
},
|
41
|
+
"sideEffects": false,
|
42
|
+
"devDependencies": {
|
43
|
+
"@arethetypeswrong/cli": "^0.12.2",
|
44
|
+
"@types/node": "^20.8.7",
|
45
|
+
"esbuild": "^0.19.5",
|
46
|
+
"expect": "^29.7.0",
|
47
|
+
"tsm": "^2.3.0",
|
48
|
+
"typescript": "^5.2.2"
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,133 @@
|
|
1
|
+
{
|
2
|
+
"name": "lib",
|
3
|
+
"lockfileVersion": 3,
|
4
|
+
"requires": true,
|
5
|
+
"packages": {
|
6
|
+
"": {
|
7
|
+
"dependencies": {
|
8
|
+
"react": "^18.3.1",
|
9
|
+
"react-dom": "^18.3.1",
|
10
|
+
"react-router-dom": "^7.5.0"
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"node_modules/@types/cookie": {
|
14
|
+
"version": "0.6.0",
|
15
|
+
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
|
16
|
+
"integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==",
|
17
|
+
"license": "MIT"
|
18
|
+
},
|
19
|
+
"node_modules/cookie": {
|
20
|
+
"version": "1.0.2",
|
21
|
+
"resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz",
|
22
|
+
"integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==",
|
23
|
+
"license": "MIT",
|
24
|
+
"engines": {
|
25
|
+
"node": ">=18"
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"node_modules/js-tokens": {
|
29
|
+
"version": "4.0.0",
|
30
|
+
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
31
|
+
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
32
|
+
"license": "MIT"
|
33
|
+
},
|
34
|
+
"node_modules/loose-envify": {
|
35
|
+
"version": "1.4.0",
|
36
|
+
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
37
|
+
"integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
|
38
|
+
"license": "MIT",
|
39
|
+
"dependencies": {
|
40
|
+
"js-tokens": "^3.0.0 || ^4.0.0"
|
41
|
+
},
|
42
|
+
"bin": {
|
43
|
+
"loose-envify": "cli.js"
|
44
|
+
}
|
45
|
+
},
|
46
|
+
"node_modules/react": {
|
47
|
+
"version": "18.3.1",
|
48
|
+
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
49
|
+
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
50
|
+
"license": "MIT",
|
51
|
+
"dependencies": {
|
52
|
+
"loose-envify": "^1.1.0"
|
53
|
+
},
|
54
|
+
"engines": {
|
55
|
+
"node": ">=0.10.0"
|
56
|
+
}
|
57
|
+
},
|
58
|
+
"node_modules/react-dom": {
|
59
|
+
"version": "18.3.1",
|
60
|
+
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
61
|
+
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
62
|
+
"license": "MIT",
|
63
|
+
"dependencies": {
|
64
|
+
"loose-envify": "^1.1.0",
|
65
|
+
"scheduler": "^0.23.2"
|
66
|
+
},
|
67
|
+
"peerDependencies": {
|
68
|
+
"react": "^18.3.1"
|
69
|
+
}
|
70
|
+
},
|
71
|
+
"node_modules/react-router": {
|
72
|
+
"version": "7.5.0",
|
73
|
+
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.5.0.tgz",
|
74
|
+
"integrity": "sha512-estOHrRlDMKdlQa6Mj32gIks4J+AxNsYoE0DbTTxiMy2mPzZuWSDU+N85/r1IlNR7kGfznF3VCUlvc5IUO+B9g==",
|
75
|
+
"license": "MIT",
|
76
|
+
"dependencies": {
|
77
|
+
"@types/cookie": "^0.6.0",
|
78
|
+
"cookie": "^1.0.1",
|
79
|
+
"set-cookie-parser": "^2.6.0",
|
80
|
+
"turbo-stream": "2.4.0"
|
81
|
+
},
|
82
|
+
"engines": {
|
83
|
+
"node": ">=20.0.0"
|
84
|
+
},
|
85
|
+
"peerDependencies": {
|
86
|
+
"react": ">=18",
|
87
|
+
"react-dom": ">=18"
|
88
|
+
},
|
89
|
+
"peerDependenciesMeta": {
|
90
|
+
"react-dom": {
|
91
|
+
"optional": true
|
92
|
+
}
|
93
|
+
}
|
94
|
+
},
|
95
|
+
"node_modules/react-router-dom": {
|
96
|
+
"version": "7.5.0",
|
97
|
+
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.5.0.tgz",
|
98
|
+
"integrity": "sha512-fFhGFCULy4vIseTtH5PNcY/VvDJK5gvOWcwJVHQp8JQcWVr85ENhJ3UpuF/zP1tQOIFYNRJHzXtyhU1Bdgw0RA==",
|
99
|
+
"license": "MIT",
|
100
|
+
"dependencies": {
|
101
|
+
"react-router": "7.5.0"
|
102
|
+
},
|
103
|
+
"engines": {
|
104
|
+
"node": ">=20.0.0"
|
105
|
+
},
|
106
|
+
"peerDependencies": {
|
107
|
+
"react": ">=18",
|
108
|
+
"react-dom": ">=18"
|
109
|
+
}
|
110
|
+
},
|
111
|
+
"node_modules/scheduler": {
|
112
|
+
"version": "0.23.2",
|
113
|
+
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
|
114
|
+
"integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
|
115
|
+
"license": "MIT",
|
116
|
+
"dependencies": {
|
117
|
+
"loose-envify": "^1.1.0"
|
118
|
+
}
|
119
|
+
},
|
120
|
+
"node_modules/set-cookie-parser": {
|
121
|
+
"version": "2.7.1",
|
122
|
+
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz",
|
123
|
+
"integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==",
|
124
|
+
"license": "MIT"
|
125
|
+
},
|
126
|
+
"node_modules/turbo-stream": {
|
127
|
+
"version": "2.4.0",
|
128
|
+
"resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz",
|
129
|
+
"integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==",
|
130
|
+
"license": "ISC"
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
data/lib/package.json
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"scripts": {
|
3
|
+
"build": "node esbuild.config.js",
|
4
|
+
"watch": "node esbuild.config.js --watch",
|
5
|
+
"prepare": "npm install react react-dom react-router-dom"
|
6
|
+
},
|
7
|
+
"dependencies": {
|
8
|
+
"react": "^18.3.1",
|
9
|
+
"react-dom": "^18.3.1",
|
10
|
+
"react-router-dom": "^7.5.0"
|
11
|
+
}
|
12
|
+
}
|
@@ -18,6 +18,16 @@ module Rubee
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def js
|
22
|
+
js_path = File.join(JS_DIR, @request.path.sub('/js/', ''))
|
23
|
+
|
24
|
+
if File.exist?(js_path) && File.file?(js_path)
|
25
|
+
response_with(object: File.read(js_path), type: :js)
|
26
|
+
else
|
27
|
+
response_with(object: 'Js file is not found', type: :text)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
21
31
|
def response_with type: nil, object: nil, status: 200, mime_type: nil, render_view: nil, headers: {}, to: nil,
|
22
32
|
file: nil, filename: nil, **options
|
23
33
|
case type&.to_sym
|
@@ -26,6 +36,8 @@ module Rubee
|
|
26
36
|
[status, headers.merge('content-type' => 'application/json'), [rendered_json]]
|
27
37
|
in :image
|
28
38
|
[status, headers.merge('content-type' => mime_type), [object]]
|
39
|
+
in :js
|
40
|
+
[status, headers.merge('content-type' => 'application/javascript'), [object]]
|
29
41
|
in :file
|
30
42
|
[
|
31
43
|
status,
|
@@ -41,6 +53,8 @@ module Rubee
|
|
41
53
|
[401, headers.merge('content-type' => 'text/plain'), ['Unauthentificated']]
|
42
54
|
in :redirect
|
43
55
|
[302, headers.merge('location' => to.to_s), ['Unauthentificated']]
|
56
|
+
in :not_found
|
57
|
+
[404, { 'content-type' => 'text/plain' }, ['Route not found']]
|
44
58
|
else # rendering erb view is a default behavior
|
45
59
|
view_file_name = self.class.name.split('Controller').first.downcase
|
46
60
|
erb_file = render_view ? render_view.to_s : "#{view_file_name}_#{@route[:action]}"
|