fullstacked 0.12.1-1358 → 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.
- package/fullstacked_modules/build/build.ts +16 -12
- package/fullstacked_modules/build/sass.ts +28 -19
- package/index.js +19 -11
- package/package.json +1 -1
|
@@ -12,10 +12,14 @@ import fs from "../fs";
|
|
|
12
12
|
core_message.addListener("build-style", async (messageStr) => {
|
|
13
13
|
const { id, entryPoint, projectId } = JSON.parse(messageStr);
|
|
14
14
|
const result = await buildSASS(entryPoint, {
|
|
15
|
+
projectId,
|
|
15
16
|
canonicalize: (filePath) => new URL(filePath, "file://"),
|
|
16
|
-
load: (url) =>
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
load: (url) =>
|
|
18
|
+
fs.readFile(projectId + url.pathname, { encoding: "utf8" })
|
|
19
|
+
});
|
|
20
|
+
bridge(
|
|
21
|
+
new Uint8Array([58, ...serializeArgs([id, JSON.stringify(result)])])
|
|
22
|
+
);
|
|
19
23
|
});
|
|
20
24
|
|
|
21
25
|
const activeBuilds = new Map<
|
|
@@ -34,14 +38,14 @@ function buildResponse(buildResult: string) {
|
|
|
34
38
|
...error,
|
|
35
39
|
location: error.location
|
|
36
40
|
? {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
+
}
|
|
45
49
|
: null
|
|
46
50
|
}));
|
|
47
51
|
activeBuild.resolve(messages);
|
|
@@ -65,7 +69,7 @@ export function buildProject(project?: Project): Promise<Message[]> {
|
|
|
65
69
|
args.push(buildId);
|
|
66
70
|
|
|
67
71
|
const payload = new Uint8Array([56, ...serializeArgs(args)]);
|
|
68
|
-
|
|
72
|
+
|
|
69
73
|
return new Promise((resolve) => {
|
|
70
74
|
activeBuilds.set(buildId, {
|
|
71
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(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: url.pathname.endsWith(".
|
|
22
|
-
? "
|
|
23
|
-
: "
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
35
|
-
|
|
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(
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
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
|
-
|
|
385
|
-
|
|
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;
|