fullstacked 0.12.1-1357 → 0.12.1-1359

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.
@@ -10,13 +10,16 @@ import { buildSASS } from "./sass";
10
10
  import fs from "../fs";
11
11
 
12
12
  core_message.addListener("build-style", async (messageStr) => {
13
- console.log(messageStr)
14
13
  const { id, entryPoint, projectId } = JSON.parse(messageStr);
15
14
  const result = await buildSASS(entryPoint, {
15
+ projectId,
16
16
  canonicalize: (filePath) => new URL(filePath, "file://"),
17
- load: (url) => fs.readFile(projectId + url.pathname, { encoding: "utf8" })
18
- })
19
- bridge(new Uint8Array([58, ...serializeArgs([id, JSON.stringify(result)])]))
17
+ load: (url) =>
18
+ fs.readFile(projectId + url.pathname, { encoding: "utf8" })
19
+ });
20
+ bridge(
21
+ new Uint8Array([58, ...serializeArgs([id, JSON.stringify(result)])])
22
+ );
20
23
  });
21
24
 
22
25
  const activeBuilds = new Map<
@@ -35,14 +38,14 @@ function buildResponse(buildResult: string) {
35
38
  ...error,
36
39
  location: error.location
37
40
  ? {
38
- ...error.location,
39
- file: error.location.file.includes(activeBuild.project.id)
40
- ? activeBuild.project.id +
41
- error.location.file
42
- .split(activeBuild.project.id)
43
- .pop()
44
- : error.location.file
45
- }
41
+ ...error.location,
42
+ file: error.location.file.includes(activeBuild.project.id)
43
+ ? activeBuild.project.id +
44
+ error.location.file
45
+ .split(activeBuild.project.id)
46
+ .pop()
47
+ : error.location.file
48
+ }
46
49
  : null
47
50
  }));
48
51
  activeBuild.resolve(messages);
@@ -66,7 +69,7 @@ export function buildProject(project?: Project): Promise<Message[]> {
66
69
  args.push(buildId);
67
70
 
68
71
  const payload = new Uint8Array([56, ...serializeArgs(args)]);
69
-
72
+
70
73
  return new Promise((resolve) => {
71
74
  activeBuilds.set(buildId, {
72
75
  project,
@@ -3,36 +3,45 @@ import * as sass from "sass";
3
3
  export async function buildSASS(
4
4
  entryPoint: string,
5
5
  opts: {
6
+ projectId?: string;
6
7
  canonicalize: (filePath: string) => URL | Promise<URL>;
7
8
  load: (url: URL) => string | Promise<string>;
8
9
  }
9
10
  ) {
10
11
  try {
11
- const { css } = await sass.compileStringAsync(await opts.load(await opts.canonicalize(entryPoint)), {
12
- syntax: entryPoint.endsWith(".sass")
13
- ? "indented"
14
- : entryPoint.endsWith(".scss")
15
- ? "scss"
16
- : "css",
17
- importer: {
18
- load: async (url) => ({
19
- syntax: url.pathname.endsWith(".sass")
20
- ? "indented"
21
- : url.pathname.endsWith(".scss")
22
- ? "scss"
23
- : "css",
24
- contents: await opts.load(url)
25
- }),
26
- canonicalize: opts.canonicalize
12
+ const { css } = await sass.compileStringAsync(
13
+ await opts.load(await opts.canonicalize(entryPoint)),
14
+ {
15
+ syntax: entryPoint.endsWith(".sass")
16
+ ? "indented"
17
+ : entryPoint.endsWith(".scss")
18
+ ? "scss"
19
+ : "css",
20
+ importer: {
21
+ load: async (url) => ({
22
+ syntax: url.pathname.endsWith(".sass")
23
+ ? "indented"
24
+ : url.pathname.endsWith(".scss")
25
+ ? "scss"
26
+ : "css",
27
+ contents: await opts.load(url)
28
+ }),
29
+ canonicalize: opts.canonicalize
30
+ }
27
31
  }
28
- });
32
+ );
29
33
  return {
30
34
  css,
31
35
  errors: []
32
36
  };
33
37
  } catch (e) {
34
- console.log(e);
35
- const File = e.span.url?.pathname;
38
+ let File = e.span.url?.pathname || entryPoint;
39
+ if (File.startsWith("/")) {
40
+ File = File.slice(1);
41
+ }
42
+ if (opts.projectId) {
43
+ File = opts.projectId + "/" + File;
44
+ }
36
45
  const Line = e.span.start.line + 1;
37
46
  const Column = e.span.start.column;
38
47
  const Length = e.span.text.length;
package/index.js CHANGED
@@ -366,23 +366,31 @@ function createPayloadHeader(opts) {
366
366
  import * as sass from "sass";
367
367
  async function buildSASS(entryPoint, opts) {
368
368
  try {
369
- const { css } = await sass.compileStringAsync(await opts.load(await opts.canonicalize(entryPoint)), {
370
- syntax: entryPoint.endsWith(".sass") ? "indented" : entryPoint.endsWith(".scss") ? "scss" : "css",
371
- importer: {
372
- load: async (url2) => ({
373
- syntax: url2.pathname.endsWith(".sass") ? "indented" : url2.pathname.endsWith(".scss") ? "scss" : "css",
374
- contents: await opts.load(url2)
375
- }),
376
- canonicalize: opts.canonicalize
369
+ const { css } = await sass.compileStringAsync(
370
+ await opts.load(await opts.canonicalize(entryPoint)),
371
+ {
372
+ syntax: entryPoint.endsWith(".sass") ? "indented" : entryPoint.endsWith(".scss") ? "scss" : "css",
373
+ importer: {
374
+ load: async (url2) => ({
375
+ syntax: url2.pathname.endsWith(".sass") ? "indented" : url2.pathname.endsWith(".scss") ? "scss" : "css",
376
+ contents: await opts.load(url2)
377
+ }),
378
+ canonicalize: opts.canonicalize
379
+ }
377
380
  }
378
- });
381
+ );
379
382
  return {
380
383
  css,
381
384
  errors: []
382
385
  };
383
386
  } catch (e) {
384
- console.log(e);
385
- const File = e.span.url?.pathname;
387
+ let File = e.span.url?.pathname || entryPoint;
388
+ if (File.startsWith("/")) {
389
+ File = File.slice(1);
390
+ }
391
+ if (opts.projectId) {
392
+ File = opts.projectId + "/" + File;
393
+ }
386
394
  const Line = e.span.start.line + 1;
387
395
  const Column = e.span.start.column;
388
396
  const Length = e.span.text.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fullstacked",
3
- "version": "0.12.1-1357",
3
+ "version": "0.12.1-1359",
4
4
  "scripts": {
5
5
  "build": "node build.js",
6
6
  "postbuild": "node build.js --binding",