fullstacked 0.12.0-1215 → 0.12.0-1260

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.
@@ -39,7 +39,6 @@ export function initRespondLinuxGTK() {
39
39
  globalThis.respond = (base64: string) => {
40
40
  const data = toByteArray(base64);
41
41
  const id = bytesToNumber(data.slice(0, 4));
42
- console.log(id);
43
42
  const resolver = requests.get(id);
44
43
  resolver(data.slice(4));
45
44
  requests.delete(id);
@@ -6,6 +6,7 @@ import {
6
6
  serializeArgs
7
7
  } from "../bridge/serialization";
8
8
  import core_message from "../core_message";
9
+ import { ar } from "zod/v4/locales";
9
10
 
10
11
  const te = new TextEncoder();
11
12
 
@@ -182,7 +183,7 @@ function receivedResponse2(base64Data: string) {
182
183
 
183
184
  const readBody = async () => {
184
185
  if (!ok) {
185
- return te.encode(statusText);
186
+ return te.encode(statusText) as Uint8Array<ArrayBuffer>;
186
187
  }
187
188
  let body = new Uint8Array();
188
189
  for await (const chunk of responseIterator) {
package/index.js CHANGED
@@ -42,7 +42,6 @@ function callLib(payload) {
42
42
  import http from "http";
43
43
  import net from "net";
44
44
  import open from "open";
45
- import fastQueryString from "fast-querystring";
46
45
  import { WebSocketServer } from "ws";
47
46
 
48
47
  // ../../fullstacked_modules/bridge/serialization.ts
@@ -141,53 +140,6 @@ function deserializeArgs(data) {
141
140
  return args;
142
141
  }
143
142
 
144
- // ../../fullstacked_modules/base64.ts
145
- var lookup = [];
146
- var revLookup = [];
147
- var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
148
- for (let i = 0, len = code.length; i < len; ++i) {
149
- lookup[i] = code[i];
150
- revLookup[code.charCodeAt(i)] = i;
151
- }
152
- revLookup["-".charCodeAt(0)] = 62;
153
- revLookup["_".charCodeAt(0)] = 63;
154
- function getLens(b64) {
155
- var len = b64.length;
156
- var validLen = b64.indexOf("=");
157
- if (validLen === -1) validLen = len;
158
- var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
159
- return [validLen, placeHoldersLen];
160
- }
161
- function _byteLength(b64, validLen, placeHoldersLen) {
162
- return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
163
- }
164
- function toByteArray(b64) {
165
- let tmp;
166
- const lens = getLens(b64);
167
- const validLen = lens[0];
168
- const placeHoldersLen = lens[1];
169
- const arr = new Uint8Array(_byteLength(b64, validLen, placeHoldersLen));
170
- let curByte = 0;
171
- const len = placeHoldersLen > 0 ? validLen - 4 : validLen;
172
- let i;
173
- for (i = 0; i < len; i += 4) {
174
- tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
175
- arr[curByte++] = tmp >> 16 & 255;
176
- arr[curByte++] = tmp >> 8 & 255;
177
- arr[curByte++] = tmp & 255;
178
- }
179
- if (placeHoldersLen === 2) {
180
- tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
181
- arr[curByte++] = tmp & 255;
182
- }
183
- if (placeHoldersLen === 1) {
184
- tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
185
- arr[curByte++] = tmp >> 8 & 255;
186
- arr[curByte++] = tmp & 255;
187
- }
188
- return arr;
189
- }
190
-
191
143
  // src/webview.ts
192
144
  var te2 = new TextEncoder();
193
145
  async function createWebView(instance, onClose, onFirstConnection) {
@@ -249,19 +201,7 @@ function createHandler(instance) {
249
201
  return res.end(platform);
250
202
  } else if (pathname === "/call") {
251
203
  const payload2 = await readBody(req);
252
- const data2 = await instance.call(payload2);
253
- res.writeHead(200, {
254
- "content-type": "application/octet-stream",
255
- "content-length": data2.length,
256
- "cache-control": "no-cache"
257
- });
258
- return res.end(data2);
259
- }
260
- if (instance.isEditor && pathname === "/call-sync") {
261
- const parsedQuery = fastQueryString.parse(query);
262
- const payloadBase64 = decodeURIComponent(parsedQuery.payload);
263
- const payload2 = toByteArray(payloadBase64);
264
- const data2 = await instance.call(payload2);
204
+ const data2 = instance.call(payload2);
265
205
  res.writeHead(200, {
266
206
  "content-type": "application/octet-stream",
267
207
  "content-length": data2.length,
@@ -298,23 +238,42 @@ function createHandler(instance) {
298
238
  res.end(data);
299
239
  };
300
240
  }
241
+ var readBodyQueue = [];
242
+ var processingRequestLock = false;
243
+ function processRequests() {
244
+ if (processingRequestLock) {
245
+ return;
246
+ }
247
+ const readBody2 = readBodyQueue.shift();
248
+ if (!readBody2) {
249
+ return;
250
+ }
251
+ processingRequestLock = true;
252
+ const { req, resolve } = readBody2;
253
+ const end = (body2) => {
254
+ resolve(body2);
255
+ processingRequestLock = false;
256
+ processRequests();
257
+ };
258
+ const contentLengthStr = req.headers["content-length"] || "0";
259
+ const contentLength = parseInt(contentLengthStr);
260
+ if (!contentLength) {
261
+ return end(new Uint8Array());
262
+ }
263
+ const body = new Uint8Array(contentLength);
264
+ let i = 0;
265
+ req.on("data", (chunk) => {
266
+ for (let j = 0; j < chunk.byteLength; j++) {
267
+ body[j + i] = chunk[j];
268
+ }
269
+ i += chunk.length;
270
+ });
271
+ req.on("end", () => end(body));
272
+ }
301
273
  function readBody(req) {
302
274
  return new Promise((resolve) => {
303
- const contentLengthStr = req.headers["content-length"] || "0";
304
- const contentLength = parseInt(contentLengthStr);
305
- if (!contentLength) {
306
- resolve(new Uint8Array());
307
- return;
308
- }
309
- const body = new Uint8Array(contentLength);
310
- let i = 0;
311
- req.on("data", (chunk) => {
312
- for (let j = 0; j < chunk.byteLength; j++) {
313
- body[j + i] = chunk[j];
314
- }
315
- i += chunk.length;
316
- });
317
- req.on("end", () => resolve(body));
275
+ readBodyQueue.push({ req, resolve });
276
+ processRequests();
318
277
  });
319
278
  }
320
279
  function getNextAvailablePort(port = 9e3, host = "0.0.0.0") {
@@ -396,6 +355,53 @@ function createPayloadHeader(opts) {
396
355
  // src/build.ts
397
356
  import { promises } from "node:fs";
398
357
 
358
+ // ../../fullstacked_modules/base64.ts
359
+ var lookup = [];
360
+ var revLookup = [];
361
+ var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
362
+ for (let i = 0, len = code.length; i < len; ++i) {
363
+ lookup[i] = code[i];
364
+ revLookup[code.charCodeAt(i)] = i;
365
+ }
366
+ revLookup["-".charCodeAt(0)] = 62;
367
+ revLookup["_".charCodeAt(0)] = 63;
368
+ function getLens(b64) {
369
+ var len = b64.length;
370
+ var validLen = b64.indexOf("=");
371
+ if (validLen === -1) validLen = len;
372
+ var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
373
+ return [validLen, placeHoldersLen];
374
+ }
375
+ function _byteLength(b64, validLen, placeHoldersLen) {
376
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
377
+ }
378
+ function toByteArray(b64) {
379
+ let tmp;
380
+ const lens = getLens(b64);
381
+ const validLen = lens[0];
382
+ const placeHoldersLen = lens[1];
383
+ const arr = new Uint8Array(_byteLength(b64, validLen, placeHoldersLen));
384
+ let curByte = 0;
385
+ const len = placeHoldersLen > 0 ? validLen - 4 : validLen;
386
+ let i;
387
+ for (i = 0; i < len; i += 4) {
388
+ tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
389
+ arr[curByte++] = tmp >> 16 & 255;
390
+ arr[curByte++] = tmp >> 8 & 255;
391
+ arr[curByte++] = tmp & 255;
392
+ }
393
+ if (placeHoldersLen === 2) {
394
+ tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
395
+ arr[curByte++] = tmp & 255;
396
+ }
397
+ if (placeHoldersLen === 1) {
398
+ tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
399
+ arr[curByte++] = tmp >> 8 & 255;
400
+ arr[curByte++] = tmp & 255;
401
+ }
402
+ return arr;
403
+ }
404
+
399
405
  // ../../fullstacked_modules/esbuild/sass.ts
400
406
  import * as sass from "sass";
401
407
  async function buildSASS(fs3, project) {
@@ -604,34 +610,41 @@ import { createRequire } from "node:module";
604
610
  // src/dev-files.ts
605
611
  import path3 from "node:path";
606
612
  import fs2 from "node:fs";
607
- var defaultTsConfig = {
613
+
614
+ // ../../editor/views/project/workspace/tsconfig.ts
615
+ var compilerOptions = {
616
+ esModuleInterop: true,
617
+ module: "es2022",
618
+ target: "es2022",
619
+ moduleResolution: "node10",
620
+ allowJs: true,
621
+ lib: ["dom", "dom.iterable", "es2023"],
622
+ jsx: "react",
623
+ paths: {
624
+ "*": ["../.fullstacked_modules/*"]
625
+ },
626
+ typeRoots: ["../.fullstacked_modules", "./node_modules/@types"]
627
+ };
628
+
629
+ // src/dev-files.ts
630
+ var tsConfig = {
608
631
  compilerOptions: {
609
- esModuleInterop: true,
610
- module: "ES2022",
611
- target: "ES2022",
612
- moduleResolution: "Node10",
613
- allowJs: true,
614
- lib: ["dom", "dom.iterable", "es2023"],
615
- jsx: "react",
632
+ ...compilerOptions,
616
633
  paths: {
617
- "*": ["./node_modules/fullstacked/fullstacked_modules/*"]
634
+ "*": ["./.fullstacked_modules/*"]
618
635
  },
619
- typeRoots: [
620
- "./node_modules/fullstacked/fullstacked_modules",
621
- "./node_modules/@types"
622
- ]
636
+ typeRoots: ["./.fullstacked_modules", "./node_modules/@types"]
623
637
  }
624
638
  };
625
639
  var defaultGitignore = `node_modules
626
640
  .build
627
- data`;
641
+ data
642
+ tsconfig.json
643
+ .fullstacked_modules`;
628
644
  function setupDevFiles() {
629
645
  const tsConfigFile = path3.resolve(process.cwd(), "tsconfig.json");
630
646
  if (!fs2.existsSync(tsConfigFile)) {
631
- fs2.writeFileSync(
632
- tsConfigFile,
633
- JSON.stringify(defaultTsConfig, null, 4)
634
- );
647
+ fs2.writeFileSync(tsConfigFile, JSON.stringify(tsConfig, null, 4));
635
648
  }
636
649
  const gitignoreFile = path3.resolve(process.cwd(), ".gitignore");
637
650
  if (!fs2.existsSync(gitignoreFile)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fullstacked",
3
- "version": "0.12.0-1215",
3
+ "version": "0.12.0-1260",
4
4
  "scripts": {
5
5
  "build": "node build.js",
6
6
  "start": "npm run build && node index.js --lib ../../core/bin --root ~/FullStacked --config ~/.config/fullstacked --editor ../../out/editor",
@@ -1,32 +0,0 @@
1
- import { CONFIG_DATA_TYPE, CONFIG_TYPE } from "../../editor/types";
2
- import { bridge } from "../bridge";
3
- import { serializeArgs } from "../bridge/serialization";
4
-
5
- export function get<T extends CONFIG_TYPE>(
6
- configType: T,
7
- checkExists: boolean = false
8
- ): Promise<CONFIG_DATA_TYPE[T]> {
9
- const payload = new Uint8Array([50, ...serializeArgs([configType])]);
10
-
11
- const transformer = ([string]) => {
12
- if (!string) {
13
- return checkExists ? null : {};
14
- }
15
-
16
- return JSON.parse(string);
17
- };
18
-
19
- return bridge(payload, transformer);
20
- }
21
-
22
- export function save<T extends CONFIG_TYPE>(
23
- configType: T,
24
- configData: CONFIG_DATA_TYPE[T]
25
- ): Promise<boolean> {
26
- const payload = new Uint8Array([
27
- 51,
28
- ...serializeArgs([configType, JSON.stringify(configData)])
29
- ]);
30
-
31
- return bridge(payload, ([success]) => success);
32
- }
File without changes
@@ -1,3 +0,0 @@
1
- import * as config from "./config";
2
- export default config;
3
- export * from "./config";
@@ -1,13 +0,0 @@
1
- import "./ai";
2
- import "./archive";
3
- import "./connect";
4
- import "./fetch";
5
- import "./fs";
6
- import "./platform";
7
- declare module "ai";
8
- declare module "archive";
9
- declare module "connect";
10
- declare module "fetch";
11
- declare module "fs";
12
- //@ts-ignore
13
- declare module "platform";