@absolutejs/absolute 0.19.0-beta.691 → 0.19.0-beta.693
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/dist/angular/index.js +184 -177
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +166 -159
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +409 -391
- package/dist/build.js.map +9 -9
- package/dist/index.js +450 -431
- package/dist/index.js.map +10 -10
- package/dist/islands/index.js +64 -78
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +64 -78
- package/dist/react/index.js.map +3 -3
- package/dist/src/build/compileAngular.d.ts +4 -3
- package/dist/src/build/compileSvelte.d.ts +2 -1
- package/dist/src/build/compileVue.d.ts +2 -1
- package/dist/src/build/stylePreprocessor.d.ts +6 -4
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -0
- package/dist/svelte/index.js +70 -84
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +64 -78
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +28 -0
- package/dist/vue/index.js +64 -78
- package/dist/vue/index.js.map +3 -3
- package/package.json +7 -7
package/dist/angular/index.js
CHANGED
|
@@ -1352,10 +1352,9 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
1352
1352
|
});
|
|
1353
1353
|
|
|
1354
1354
|
// src/build/stylePreprocessor.ts
|
|
1355
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
1356
1355
|
import { readFile } from "fs/promises";
|
|
1357
1356
|
import { createRequire } from "module";
|
|
1358
|
-
import { dirname as dirname2, extname, join as join3 } from "path";
|
|
1357
|
+
import { dirname as dirname2, extname, join as join3, resolve as resolve4 } from "path";
|
|
1359
1358
|
var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
1360
1359
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
1361
1360
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -1365,24 +1364,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1365
1364
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
1366
1365
|
return "less";
|
|
1367
1366
|
return null;
|
|
1368
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1367
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
1368
|
+
dirname2(filePath),
|
|
1369
|
+
process.cwd(),
|
|
1370
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
1371
|
+
], getSassOptions = (config, language) => ({
|
|
1372
|
+
...config?.sass ?? {},
|
|
1373
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
1374
|
+
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
1375
|
+
${contents}` : contents, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
1375
1376
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
1376
|
-
const
|
|
1377
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
1377
1378
|
if (language === "scss" || language === "sass") {
|
|
1379
|
+
const options = getSassOptions(config, language);
|
|
1380
|
+
const packageName = options.implementation ?? "sass";
|
|
1378
1381
|
let sass;
|
|
1379
1382
|
try {
|
|
1380
|
-
sass = await importOptionalPeer(
|
|
1383
|
+
sass = await importOptionalPeer(packageName);
|
|
1381
1384
|
} catch {
|
|
1382
|
-
throw missingDependencyError(
|
|
1385
|
+
throw missingDependencyError(packageName, filePath);
|
|
1383
1386
|
}
|
|
1387
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1384
1388
|
const result = sass.compileString(contents, {
|
|
1385
|
-
loadPaths:
|
|
1389
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
1386
1390
|
style: "expanded",
|
|
1387
1391
|
syntax: language === "sass" ? "indented" : "scss",
|
|
1388
1392
|
url: new URL(`file://${filePath}`)
|
|
@@ -1390,6 +1394,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1390
1394
|
return result.css;
|
|
1391
1395
|
}
|
|
1392
1396
|
if (language === "less") {
|
|
1397
|
+
const options = getLessOptions(config);
|
|
1393
1398
|
let lessModule;
|
|
1394
1399
|
try {
|
|
1395
1400
|
lessModule = await importOptionalPeer("less");
|
|
@@ -1400,14 +1405,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1400
1405
|
const render = less?.render;
|
|
1401
1406
|
if (!render)
|
|
1402
1407
|
throw missingDependencyError("less", filePath);
|
|
1408
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
1403
1409
|
const result = await render(contents, {
|
|
1410
|
+
...options.options ?? {},
|
|
1404
1411
|
filename: filePath,
|
|
1405
|
-
paths:
|
|
1412
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
1406
1413
|
});
|
|
1407
1414
|
return result.css;
|
|
1408
1415
|
}
|
|
1409
|
-
return
|
|
1410
|
-
},
|
|
1416
|
+
return rawContents;
|
|
1417
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
1418
|
+
name: "absolute-style-preprocessor",
|
|
1419
|
+
setup(build) {
|
|
1420
|
+
const cssModuleSources = new Map;
|
|
1421
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
1422
|
+
namespace: "absolute-style-module",
|
|
1423
|
+
path: path.slice("absolute-style-module:".length)
|
|
1424
|
+
}));
|
|
1425
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
1426
|
+
const sourcePath = cssModuleSources.get(path);
|
|
1427
|
+
if (!sourcePath) {
|
|
1428
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
1429
|
+
}
|
|
1430
|
+
return {
|
|
1431
|
+
contents: await compileStyleSource(sourcePath, undefined, undefined, config),
|
|
1432
|
+
loader: "css"
|
|
1433
|
+
};
|
|
1434
|
+
});
|
|
1435
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
1436
|
+
if (isStyleModulePath(path)) {
|
|
1437
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
1438
|
+
cssModuleSources.set(cssModulePath, path);
|
|
1439
|
+
return {
|
|
1440
|
+
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
1441
|
+
loader: "js"
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
return {
|
|
1445
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
1446
|
+
loader: "css"
|
|
1447
|
+
};
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
1411
1451
|
style: async ({
|
|
1412
1452
|
attributes,
|
|
1413
1453
|
content,
|
|
@@ -1418,35 +1458,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
1418
1458
|
return;
|
|
1419
1459
|
const path = filename ?? `style.${language}`;
|
|
1420
1460
|
return {
|
|
1421
|
-
code: await compileStyleSource(path, content, language)
|
|
1461
|
+
code: await compileStyleSource(path, content, language, config)
|
|
1422
1462
|
};
|
|
1423
1463
|
}
|
|
1424
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
1464
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
1425
1465
|
if (!isPreprocessableStylePath(filePath)) {
|
|
1426
1466
|
return readFile(filePath, "utf-8");
|
|
1427
1467
|
}
|
|
1428
|
-
return compileStyleSource(filePath);
|
|
1429
|
-
}, compileStyleFileIfNeededSync = (filePath) => {
|
|
1430
|
-
const contents = readFileSync3(filePath, "utf-8");
|
|
1431
|
-
const language = getStyleLanguage(filePath);
|
|
1432
|
-
if (language === "scss" || language === "sass") {
|
|
1433
|
-
let sass;
|
|
1434
|
-
try {
|
|
1435
|
-
sass = requireOptionalPeerSync("sass");
|
|
1436
|
-
} catch {
|
|
1437
|
-
throw missingDependencyError("sass", filePath);
|
|
1438
|
-
}
|
|
1439
|
-
return sass.compileString(contents, {
|
|
1440
|
-
loadPaths: [dirname2(filePath), process.cwd()],
|
|
1441
|
-
style: "expanded",
|
|
1442
|
-
syntax: language === "sass" ? "indented" : "scss",
|
|
1443
|
-
url: new URL(`file://${filePath}`)
|
|
1444
|
-
}).css;
|
|
1445
|
-
}
|
|
1446
|
-
if (language === "less") {
|
|
1447
|
-
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
1448
|
-
}
|
|
1449
|
-
return contents;
|
|
1468
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
1450
1469
|
};
|
|
1451
1470
|
var init_stylePreprocessor = __esm(() => {
|
|
1452
1471
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -1455,45 +1474,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
1455
1474
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
1456
1475
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
1457
1476
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
1458
|
-
stylePreprocessorPlugin =
|
|
1459
|
-
name: "absolute-style-preprocessor",
|
|
1460
|
-
setup(build) {
|
|
1461
|
-
const cssModuleSources = new Map;
|
|
1462
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
1463
|
-
namespace: "absolute-style-module",
|
|
1464
|
-
path: path.slice("absolute-style-module:".length)
|
|
1465
|
-
}));
|
|
1466
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
1467
|
-
const sourcePath = cssModuleSources.get(path);
|
|
1468
|
-
if (!sourcePath) {
|
|
1469
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
1470
|
-
}
|
|
1471
|
-
return {
|
|
1472
|
-
contents: await compileStyleSource(sourcePath),
|
|
1473
|
-
loader: "css"
|
|
1474
|
-
};
|
|
1475
|
-
});
|
|
1476
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
1477
|
-
if (isStyleModulePath(path)) {
|
|
1478
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
1479
|
-
cssModuleSources.set(cssModulePath, path);
|
|
1480
|
-
return {
|
|
1481
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
1482
|
-
loader: "js"
|
|
1483
|
-
};
|
|
1484
|
-
}
|
|
1485
|
-
return {
|
|
1486
|
-
contents: await compileStyleSource(path),
|
|
1487
|
-
loader: "css"
|
|
1488
|
-
};
|
|
1489
|
-
});
|
|
1490
|
-
}
|
|
1491
|
-
};
|
|
1477
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
1492
1478
|
});
|
|
1493
1479
|
|
|
1494
1480
|
// src/core/svelteServerModule.ts
|
|
1495
1481
|
import { mkdir, readdir } from "fs/promises";
|
|
1496
|
-
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as
|
|
1482
|
+
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
1497
1483
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
1498
1484
|
const importPath = relative(dirname3(from), target).replace(/\\/g, "/");
|
|
1499
1485
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -1541,7 +1527,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1541
1527
|
if (!spec.startsWith(".")) {
|
|
1542
1528
|
return null;
|
|
1543
1529
|
}
|
|
1544
|
-
const basePath =
|
|
1530
|
+
const basePath = resolve5(dirname3(from), spec);
|
|
1545
1531
|
const candidates = [
|
|
1546
1532
|
basePath,
|
|
1547
1533
|
`${basePath}.ts`,
|
|
@@ -1573,7 +1559,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
1573
1559
|
if (!spec.startsWith(".")) {
|
|
1574
1560
|
return null;
|
|
1575
1561
|
}
|
|
1576
|
-
const explicitPath =
|
|
1562
|
+
const explicitPath = resolve5(dirname3(from), spec);
|
|
1577
1563
|
if (extname2(explicitPath) === ".svelte") {
|
|
1578
1564
|
return explicitPath;
|
|
1579
1565
|
}
|
|
@@ -3546,27 +3532,27 @@ __export(exports_compileAngular, {
|
|
|
3546
3532
|
compileAngularFile: () => compileAngularFile,
|
|
3547
3533
|
compileAngular: () => compileAngular
|
|
3548
3534
|
});
|
|
3549
|
-
import { existsSync as existsSync4, readFileSync as
|
|
3550
|
-
import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as
|
|
3535
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3, promises as fs } from "fs";
|
|
3536
|
+
import { join as join5, basename as basename3, sep, dirname as dirname4, resolve as resolve6, relative as relative2 } from "path";
|
|
3551
3537
|
import ts from "typescript";
|
|
3552
3538
|
import { createHash } from "crypto";
|
|
3553
3539
|
var computeConfigHash = () => {
|
|
3554
3540
|
try {
|
|
3555
|
-
const content =
|
|
3541
|
+
const content = readFileSync3("./tsconfig.json", "utf-8");
|
|
3556
3542
|
return createHash("md5").update(content).digest("hex");
|
|
3557
3543
|
} catch {
|
|
3558
3544
|
return "";
|
|
3559
3545
|
}
|
|
3560
3546
|
}, resolveDevClientDir = () => {
|
|
3561
3547
|
const projectRoot = process.cwd();
|
|
3562
|
-
const fromSource =
|
|
3548
|
+
const fromSource = resolve6(import.meta.dir, "../dev/client");
|
|
3563
3549
|
if (existsSync4(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3564
3550
|
return fromSource;
|
|
3565
3551
|
}
|
|
3566
|
-
const fromNodeModules =
|
|
3552
|
+
const fromNodeModules = resolve6(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3567
3553
|
if (existsSync4(fromNodeModules))
|
|
3568
3554
|
return fromNodeModules;
|
|
3569
|
-
return
|
|
3555
|
+
return resolve6(import.meta.dir, "./dev/client");
|
|
3570
3556
|
}, devClientDir, hmrClientPath, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
3571
3557
|
const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
|
|
3572
3558
|
const componentNames = [];
|
|
@@ -3609,8 +3595,70 @@ ${registrations}
|
|
|
3609
3595
|
if (fileName.startsWith(outDir))
|
|
3610
3596
|
return fileName.substring(outDir.length + 1);
|
|
3611
3597
|
return fileName;
|
|
3612
|
-
},
|
|
3613
|
-
const
|
|
3598
|
+
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
3599
|
+
const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
3600
|
+
const specifiers = [];
|
|
3601
|
+
const addSpecifier = (node) => {
|
|
3602
|
+
if (!node || !ts.isStringLiteralLike(node))
|
|
3603
|
+
return;
|
|
3604
|
+
const specifier = node.text;
|
|
3605
|
+
if (isRelativeModuleSpecifier(specifier))
|
|
3606
|
+
specifiers.push(specifier);
|
|
3607
|
+
};
|
|
3608
|
+
const visit = (node) => {
|
|
3609
|
+
if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
|
|
3610
|
+
addSpecifier(node.moduleSpecifier);
|
|
3611
|
+
} else if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
|
3612
|
+
addSpecifier(node.arguments[0]);
|
|
3613
|
+
}
|
|
3614
|
+
ts.forEachChild(node, visit);
|
|
3615
|
+
};
|
|
3616
|
+
visit(sourceFile);
|
|
3617
|
+
return specifiers;
|
|
3618
|
+
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
3619
|
+
if (!isRelativeModuleSpecifier(specifier))
|
|
3620
|
+
return null;
|
|
3621
|
+
const basePath = resolve6(dirname4(fromFile), specifier);
|
|
3622
|
+
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
3623
|
+
`${basePath}.ts`,
|
|
3624
|
+
`${basePath}.tsx`,
|
|
3625
|
+
`${basePath}.mts`,
|
|
3626
|
+
`${basePath}.cts`,
|
|
3627
|
+
join5(basePath, "index.ts"),
|
|
3628
|
+
join5(basePath, "index.tsx"),
|
|
3629
|
+
join5(basePath, "index.mts"),
|
|
3630
|
+
join5(basePath, "index.cts")
|
|
3631
|
+
];
|
|
3632
|
+
return candidates.map((candidate) => resolve6(candidate)).find((candidate) => existsSync4(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
3633
|
+
}, readFileForAotTransform = async (fileName, readFile2) => {
|
|
3634
|
+
const hostSource = readFile2?.(fileName);
|
|
3635
|
+
if (typeof hostSource === "string")
|
|
3636
|
+
return hostSource;
|
|
3637
|
+
return fs.readFile(fileName, "utf-8");
|
|
3638
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile2, stylePreprocessors) => {
|
|
3639
|
+
const transformedSources = new Map;
|
|
3640
|
+
const visited = new Set;
|
|
3641
|
+
const transformFile = async (filePath) => {
|
|
3642
|
+
const resolvedPath = resolve6(filePath);
|
|
3643
|
+
if (visited.has(resolvedPath))
|
|
3644
|
+
return;
|
|
3645
|
+
visited.add(resolvedPath);
|
|
3646
|
+
if (!existsSync4(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
3647
|
+
return;
|
|
3648
|
+
const source = await readFileForAotTransform(resolvedPath, readFile2);
|
|
3649
|
+
const transformed = await inlineResources(source, dirname4(resolvedPath), stylePreprocessors);
|
|
3650
|
+
transformedSources.set(resolvedPath, transformed.source);
|
|
3651
|
+
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
3652
|
+
await Promise.all(imports.map(async (specifier) => {
|
|
3653
|
+
const resolvedImport = resolveLocalTsImport(resolvedPath, specifier);
|
|
3654
|
+
if (resolvedImport)
|
|
3655
|
+
await transformFile(resolvedImport);
|
|
3656
|
+
}));
|
|
3657
|
+
};
|
|
3658
|
+
await transformFile(inputPath);
|
|
3659
|
+
return transformedSources;
|
|
3660
|
+
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
3661
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync3(inputPath, "utf-8"));
|
|
3614
3662
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
3615
3663
|
const configHash = computeConfigHash();
|
|
3616
3664
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -3625,7 +3673,7 @@ ${registrations}
|
|
|
3625
3673
|
} else {
|
|
3626
3674
|
const tsPath = __require.resolve("typescript");
|
|
3627
3675
|
const tsRootDir = dirname4(tsPath);
|
|
3628
|
-
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir :
|
|
3676
|
+
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve6(tsRootDir, "lib");
|
|
3629
3677
|
const config = readConfiguration("./tsconfig.json");
|
|
3630
3678
|
options = {
|
|
3631
3679
|
emitDecoratorMetadata: true,
|
|
@@ -3672,13 +3720,13 @@ ${registrations}
|
|
|
3672
3720
|
};
|
|
3673
3721
|
}
|
|
3674
3722
|
const emitted = {};
|
|
3675
|
-
const resolvedOutDir =
|
|
3723
|
+
const resolvedOutDir = resolve6(outDir);
|
|
3676
3724
|
host.writeFile = (fileName, text) => {
|
|
3677
3725
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
3678
3726
|
emitted[relativePath] = text;
|
|
3679
3727
|
};
|
|
3680
3728
|
const originalReadFile = host.readFile;
|
|
3681
|
-
const
|
|
3729
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host), stylePreprocessors);
|
|
3682
3730
|
host.readFile = (fileName) => {
|
|
3683
3731
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
3684
3732
|
if (typeof source !== "string")
|
|
@@ -3686,13 +3734,8 @@ ${registrations}
|
|
|
3686
3734
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
3687
3735
|
return source;
|
|
3688
3736
|
}
|
|
3689
|
-
const resolvedPath =
|
|
3690
|
-
|
|
3691
|
-
if (cached2 !== undefined)
|
|
3692
|
-
return cached2;
|
|
3693
|
-
const transformed = inlineResourcesSync(source, dirname4(resolvedPath)).source;
|
|
3694
|
-
aotTransformCache.set(resolvedPath, transformed);
|
|
3695
|
-
return transformed;
|
|
3737
|
+
const resolvedPath = resolve6(fileName);
|
|
3738
|
+
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
3696
3739
|
};
|
|
3697
3740
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
3698
3741
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
@@ -3736,7 +3779,7 @@ ${registrations}
|
|
|
3736
3779
|
await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
|
|
3737
3780
|
return entries.map(({ target }) => target);
|
|
3738
3781
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
3739
|
-
const sourceEntry =
|
|
3782
|
+
const sourceEntry = resolve6(import.meta.dir, "../angular/components/index.ts");
|
|
3740
3783
|
if (existsSync4(sourceEntry)) {
|
|
3741
3784
|
return sourceEntry.replace(/\\/g, "/");
|
|
3742
3785
|
}
|
|
@@ -3864,10 +3907,10 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
3864
3907
|
return rewritten.replace(/export(?:\s+default)?\s+class\s+([A-Za-z_$][\w$]*)\s*{/, (match) => `${match}
|
|
3865
3908
|
${fields}
|
|
3866
3909
|
`);
|
|
3867
|
-
}, readAndEscapeFile = async (filePath) => {
|
|
3910
|
+
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
3868
3911
|
if (!existsSync4(filePath))
|
|
3869
3912
|
return null;
|
|
3870
|
-
const content = await compileStyleFileIfNeeded(filePath);
|
|
3913
|
+
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
3871
3914
|
return escapeTemplateContent(content);
|
|
3872
3915
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
3873
3916
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
@@ -3907,7 +3950,7 @@ ${fields}
|
|
|
3907
3950
|
if (!existsSync4(templatePath)) {
|
|
3908
3951
|
return { deferSlots: [], source };
|
|
3909
3952
|
}
|
|
3910
|
-
const templateRaw2 =
|
|
3953
|
+
const templateRaw2 = readFileSync3(templatePath, "utf-8");
|
|
3911
3954
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
3912
3955
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
3913
3956
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -3931,43 +3974,7 @@ ${fields}
|
|
|
3931
3974
|
deferSlots: lowered.slots,
|
|
3932
3975
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
3933
3976
|
};
|
|
3934
|
-
},
|
|
3935
|
-
if (!existsSync4(filePath))
|
|
3936
|
-
return null;
|
|
3937
|
-
const content = compileStyleFileIfNeededSync(filePath);
|
|
3938
|
-
return escapeTemplateContent(content);
|
|
3939
|
-
}, inlineStyleUrlsSync = (source, fileDir) => {
|
|
3940
|
-
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
3941
|
-
if (!styleUrlsMatch?.[1])
|
|
3942
|
-
return source;
|
|
3943
|
-
const urlMatches = styleUrlsMatch[1].match(/['"]([^'"]+)['"]/g);
|
|
3944
|
-
if (!urlMatches)
|
|
3945
|
-
return source;
|
|
3946
|
-
const inlinedStyles = urlMatches.map((urlMatch) => {
|
|
3947
|
-
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
3948
|
-
return readAndEscapeFileSync(join5(fileDir, styleUrl));
|
|
3949
|
-
}).filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
3950
|
-
if (inlinedStyles.length === 0)
|
|
3951
|
-
return source;
|
|
3952
|
-
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
3953
|
-
}, inlineSingleStyleUrlSync = (source, fileDir) => {
|
|
3954
|
-
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3955
|
-
if (!styleUrlMatch?.[1])
|
|
3956
|
-
return source;
|
|
3957
|
-
const escaped = readAndEscapeFileSync(join5(fileDir, styleUrlMatch[1]));
|
|
3958
|
-
if (!escaped)
|
|
3959
|
-
return source;
|
|
3960
|
-
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
3961
|
-
}, inlineResourcesSync = (source, fileDir) => {
|
|
3962
|
-
const inlinedTemplate = inlineTemplateAndLowerDeferSync(source, fileDir);
|
|
3963
|
-
let result = inlinedTemplate.source;
|
|
3964
|
-
result = inlineStyleUrlsSync(result, fileDir);
|
|
3965
|
-
result = inlineSingleStyleUrlSync(result, fileDir);
|
|
3966
|
-
return {
|
|
3967
|
-
deferSlots: inlinedTemplate.deferSlots,
|
|
3968
|
-
source: result
|
|
3969
|
-
};
|
|
3970
|
-
}, inlineStyleUrls = async (source, fileDir) => {
|
|
3977
|
+
}, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
|
|
3971
3978
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
3972
3979
|
if (!styleUrlsMatch?.[1])
|
|
3973
3980
|
return source;
|
|
@@ -3976,35 +3983,35 @@ ${fields}
|
|
|
3976
3983
|
return source;
|
|
3977
3984
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
3978
3985
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
3979
|
-
return readAndEscapeFile(join5(fileDir, styleUrl));
|
|
3986
|
+
return readAndEscapeFile(join5(fileDir, styleUrl), stylePreprocessors);
|
|
3980
3987
|
});
|
|
3981
3988
|
const results = await Promise.all(stylePromises);
|
|
3982
3989
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
3983
3990
|
if (inlinedStyles.length === 0)
|
|
3984
3991
|
return source;
|
|
3985
3992
|
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
3986
|
-
}, inlineSingleStyleUrl = async (source, fileDir) => {
|
|
3993
|
+
}, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
|
|
3987
3994
|
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
3988
3995
|
if (!styleUrlMatch?.[1])
|
|
3989
3996
|
return source;
|
|
3990
|
-
const escaped = await readAndEscapeFile(join5(fileDir, styleUrlMatch[1]));
|
|
3997
|
+
const escaped = await readAndEscapeFile(join5(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
3991
3998
|
if (!escaped)
|
|
3992
3999
|
return source;
|
|
3993
4000
|
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
3994
|
-
}, inlineResources = async (source, fileDir) => {
|
|
4001
|
+
}, inlineResources = async (source, fileDir, stylePreprocessors) => {
|
|
3995
4002
|
const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
|
|
3996
4003
|
let result = inlinedTemplate.source;
|
|
3997
|
-
result = await inlineStyleUrls(result, fileDir);
|
|
3998
|
-
result = await inlineSingleStyleUrl(result, fileDir);
|
|
4004
|
+
result = await inlineStyleUrls(result, fileDir, stylePreprocessors);
|
|
4005
|
+
result = await inlineSingleStyleUrl(result, fileDir, stylePreprocessors);
|
|
3999
4006
|
return {
|
|
4000
4007
|
deferSlots: inlinedTemplate.deferSlots,
|
|
4001
4008
|
source: result
|
|
4002
4009
|
};
|
|
4003
|
-
}, compileAngularFileJIT = async (inputPath, outDir, rootDir) => {
|
|
4004
|
-
const entryPath =
|
|
4010
|
+
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors) => {
|
|
4011
|
+
const entryPath = resolve6(inputPath);
|
|
4005
4012
|
const allOutputs = [];
|
|
4006
4013
|
const visited = new Set;
|
|
4007
|
-
const baseDir =
|
|
4014
|
+
const baseDir = resolve6(rootDir ?? process.cwd());
|
|
4008
4015
|
const angularTranspiler = new Bun.Transpiler({
|
|
4009
4016
|
loader: "ts",
|
|
4010
4017
|
tsconfig: JSON.stringify({
|
|
@@ -4041,13 +4048,13 @@ ${fields}
|
|
|
4041
4048
|
return `${prefix}${dots}`;
|
|
4042
4049
|
return `${prefix}../${dots}`;
|
|
4043
4050
|
});
|
|
4044
|
-
if (
|
|
4051
|
+
if (resolve6(actualPath) === entryPath) {
|
|
4045
4052
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
4046
4053
|
}
|
|
4047
4054
|
return processedContent;
|
|
4048
4055
|
};
|
|
4049
4056
|
const transpileFile = async (filePath) => {
|
|
4050
|
-
const resolved =
|
|
4057
|
+
const resolved = resolve6(filePath);
|
|
4051
4058
|
if (visited.has(resolved))
|
|
4052
4059
|
return;
|
|
4053
4060
|
visited.add(resolved);
|
|
@@ -4057,7 +4064,7 @@ ${fields}
|
|
|
4057
4064
|
if (!existsSync4(actualPath))
|
|
4058
4065
|
return;
|
|
4059
4066
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
4060
|
-
const inlined = await inlineResources(sourceCode, dirname4(actualPath));
|
|
4067
|
+
const inlined = await inlineResources(sourceCode, dirname4(actualPath), stylePreprocessors);
|
|
4061
4068
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname4(actualPath)).source;
|
|
4062
4069
|
const inputDir = dirname4(actualPath);
|
|
4063
4070
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
@@ -4089,13 +4096,13 @@ ${fields}
|
|
|
4089
4096
|
}
|
|
4090
4097
|
const inputDirForResolve = dirname4(actualPath);
|
|
4091
4098
|
await Promise.all(localImports.map((imp) => {
|
|
4092
|
-
const importPath =
|
|
4099
|
+
const importPath = resolve6(inputDirForResolve, imp);
|
|
4093
4100
|
return transpileFile(importPath);
|
|
4094
4101
|
}));
|
|
4095
4102
|
};
|
|
4096
4103
|
await transpileFile(inputPath);
|
|
4097
4104
|
return allOutputs;
|
|
4098
|
-
}, compileAngular = async (entryPoints, outRoot, hmr = false) => {
|
|
4105
|
+
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
4099
4106
|
const compiledParent = join5(outRoot, "generated");
|
|
4100
4107
|
if (entryPoints.length === 0) {
|
|
4101
4108
|
const emptyPaths = [];
|
|
@@ -4105,9 +4112,9 @@ ${fields}
|
|
|
4105
4112
|
const indexesDir = join5(compiledParent, "indexes");
|
|
4106
4113
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
4107
4114
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
4108
|
-
const resolvedEntry =
|
|
4115
|
+
const resolvedEntry = resolve6(entry);
|
|
4109
4116
|
const relativeEntry = relative2(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
4110
|
-
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot) : compileAngularFile(resolvedEntry, compiledRoot);
|
|
4117
|
+
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
4111
4118
|
let outputs = await compileEntry();
|
|
4112
4119
|
const fileBase = basename3(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
4113
4120
|
const jsName = `${fileBase}.js`;
|
|
@@ -4115,10 +4122,10 @@ ${fields}
|
|
|
4115
4122
|
join5(compiledRoot, relativeEntry),
|
|
4116
4123
|
join5(compiledRoot, "pages", jsName),
|
|
4117
4124
|
join5(compiledRoot, jsName)
|
|
4118
|
-
].map((file) =>
|
|
4125
|
+
].map((file) => resolve6(file));
|
|
4119
4126
|
const resolveRawServerFile = (candidatePaths) => {
|
|
4120
4127
|
const normalizedCandidates = [
|
|
4121
|
-
...candidatePaths.map((file) =>
|
|
4128
|
+
...candidatePaths.map((file) => resolve6(file)),
|
|
4122
4129
|
...compiledFallbackPaths
|
|
4123
4130
|
];
|
|
4124
4131
|
let candidate = normalizedCandidates.find((file) => existsSync4(file) && file.endsWith(`${sep}pages${sep}${jsName}`));
|
|
@@ -4346,19 +4353,19 @@ var init_compileAngular = __esm(() => {
|
|
|
4346
4353
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
4347
4354
|
import { mkdir as mkdir2, symlink } from "fs/promises";
|
|
4348
4355
|
import { tmpdir } from "os";
|
|
4349
|
-
import { basename as basename4, dirname as dirname5, join as join6, resolve as
|
|
4356
|
+
import { basename as basename4, dirname as dirname5, join as join6, resolve as resolve7 } from "path";
|
|
4350
4357
|
var ssrDirty = false, lastSelector = "angular-page", isRecord5 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
|
|
4351
4358
|
if (!compilerImportPromise) {
|
|
4352
4359
|
compilerImportPromise = import("@angular/compiler");
|
|
4353
4360
|
}
|
|
4354
4361
|
return compilerImportPromise;
|
|
4355
4362
|
}, readAngularPageModule = (value) => isRecord5(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join6(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
|
|
4356
|
-
const outRoot =
|
|
4363
|
+
const outRoot = resolve7(dirname5(dirname5(outDir)));
|
|
4357
4364
|
const nodeModulesLink = join6(outRoot, "node_modules");
|
|
4358
4365
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
4359
4366
|
return;
|
|
4360
4367
|
}
|
|
4361
|
-
if (nodeModulesLink ===
|
|
4368
|
+
if (nodeModulesLink === resolve7(process.cwd(), "node_modules")) {
|
|
4362
4369
|
return;
|
|
4363
4370
|
}
|
|
4364
4371
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
@@ -4366,7 +4373,7 @@ var ssrDirty = false, lastSelector = "angular-page", isRecord5 = (value) => type
|
|
|
4366
4373
|
}
|
|
4367
4374
|
await mkdir2(outRoot, { recursive: true });
|
|
4368
4375
|
try {
|
|
4369
|
-
await symlink(
|
|
4376
|
+
await symlink(resolve7(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
4370
4377
|
} catch (error) {
|
|
4371
4378
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
4372
4379
|
throw error;
|
|
@@ -5165,7 +5172,7 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5165
5172
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
5166
5173
|
var _this = this;
|
|
5167
5174
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
5168
|
-
return new promiseCtor(function(
|
|
5175
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
5169
5176
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
5170
5177
|
next: function(value) {
|
|
5171
5178
|
try {
|
|
@@ -5176,7 +5183,7 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5176
5183
|
}
|
|
5177
5184
|
},
|
|
5178
5185
|
error: reject,
|
|
5179
|
-
complete:
|
|
5186
|
+
complete: resolve8
|
|
5180
5187
|
});
|
|
5181
5188
|
_this.subscribe(subscriber);
|
|
5182
5189
|
});
|
|
@@ -5198,14 +5205,14 @@ var require_Observable = __commonJS((exports) => {
|
|
|
5198
5205
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
5199
5206
|
var _this = this;
|
|
5200
5207
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
5201
|
-
return new promiseCtor(function(
|
|
5208
|
+
return new promiseCtor(function(resolve8, reject) {
|
|
5202
5209
|
var value;
|
|
5203
5210
|
_this.subscribe(function(x) {
|
|
5204
5211
|
return value = x;
|
|
5205
5212
|
}, function(err) {
|
|
5206
5213
|
return reject(err);
|
|
5207
5214
|
}, function() {
|
|
5208
|
-
return
|
|
5215
|
+
return resolve8(value);
|
|
5209
5216
|
});
|
|
5210
5217
|
});
|
|
5211
5218
|
};
|
|
@@ -7233,11 +7240,11 @@ var require_isReadableStreamLike = __commonJS((exports) => {
|
|
|
7233
7240
|
var require_innerFrom = __commonJS((exports) => {
|
|
7234
7241
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
7235
7242
|
function adopt(value) {
|
|
7236
|
-
return value instanceof P ? value : new P(function(
|
|
7237
|
-
|
|
7243
|
+
return value instanceof P ? value : new P(function(resolve8) {
|
|
7244
|
+
resolve8(value);
|
|
7238
7245
|
});
|
|
7239
7246
|
}
|
|
7240
|
-
return new (P || (P = Promise))(function(
|
|
7247
|
+
return new (P || (P = Promise))(function(resolve8, reject) {
|
|
7241
7248
|
function fulfilled(value) {
|
|
7242
7249
|
try {
|
|
7243
7250
|
step(generator.next(value));
|
|
@@ -7253,7 +7260,7 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
7253
7260
|
}
|
|
7254
7261
|
}
|
|
7255
7262
|
function step(result) {
|
|
7256
|
-
result.done ?
|
|
7263
|
+
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
7257
7264
|
}
|
|
7258
7265
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7259
7266
|
});
|
|
@@ -7343,14 +7350,14 @@ var require_innerFrom = __commonJS((exports) => {
|
|
|
7343
7350
|
}, i);
|
|
7344
7351
|
function verb(n) {
|
|
7345
7352
|
i[n] = o[n] && function(v) {
|
|
7346
|
-
return new Promise(function(
|
|
7347
|
-
v = o[n](v), settle(
|
|
7353
|
+
return new Promise(function(resolve8, reject) {
|
|
7354
|
+
v = o[n](v), settle(resolve8, reject, v.done, v.value);
|
|
7348
7355
|
});
|
|
7349
7356
|
};
|
|
7350
7357
|
}
|
|
7351
|
-
function settle(
|
|
7358
|
+
function settle(resolve8, reject, d, v) {
|
|
7352
7359
|
Promise.resolve(v).then(function(v2) {
|
|
7353
|
-
|
|
7360
|
+
resolve8({ value: v2, done: d });
|
|
7354
7361
|
}, reject);
|
|
7355
7362
|
}
|
|
7356
7363
|
};
|
|
@@ -7926,7 +7933,7 @@ var require_lastValueFrom = __commonJS((exports) => {
|
|
|
7926
7933
|
var EmptyError_1 = require_EmptyError();
|
|
7927
7934
|
function lastValueFrom(source, config) {
|
|
7928
7935
|
var hasConfig = typeof config === "object";
|
|
7929
|
-
return new Promise(function(
|
|
7936
|
+
return new Promise(function(resolve8, reject) {
|
|
7930
7937
|
var _hasValue = false;
|
|
7931
7938
|
var _value;
|
|
7932
7939
|
source.subscribe({
|
|
@@ -7937,9 +7944,9 @@ var require_lastValueFrom = __commonJS((exports) => {
|
|
|
7937
7944
|
error: reject,
|
|
7938
7945
|
complete: function() {
|
|
7939
7946
|
if (_hasValue) {
|
|
7940
|
-
|
|
7947
|
+
resolve8(_value);
|
|
7941
7948
|
} else if (hasConfig) {
|
|
7942
|
-
|
|
7949
|
+
resolve8(config.defaultValue);
|
|
7943
7950
|
} else {
|
|
7944
7951
|
reject(new EmptyError_1.EmptyError);
|
|
7945
7952
|
}
|
|
@@ -7958,16 +7965,16 @@ var require_firstValueFrom = __commonJS((exports) => {
|
|
|
7958
7965
|
var Subscriber_1 = require_Subscriber();
|
|
7959
7966
|
function firstValueFrom(source, config) {
|
|
7960
7967
|
var hasConfig = typeof config === "object";
|
|
7961
|
-
return new Promise(function(
|
|
7968
|
+
return new Promise(function(resolve8, reject) {
|
|
7962
7969
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
7963
7970
|
next: function(value) {
|
|
7964
|
-
|
|
7971
|
+
resolve8(value);
|
|
7965
7972
|
subscriber.unsubscribe();
|
|
7966
7973
|
},
|
|
7967
7974
|
error: reject,
|
|
7968
7975
|
complete: function() {
|
|
7969
7976
|
if (hasConfig) {
|
|
7970
|
-
|
|
7977
|
+
resolve8(config.defaultValue);
|
|
7971
7978
|
} else {
|
|
7972
7979
|
reject(new EmptyError_1.EmptyError);
|
|
7973
7980
|
}
|
|
@@ -13729,5 +13736,5 @@ export {
|
|
|
13729
13736
|
Island
|
|
13730
13737
|
};
|
|
13731
13738
|
|
|
13732
|
-
//# debugId=
|
|
13739
|
+
//# debugId=616C70E79D1443DD64756E2164756E21
|
|
13733
13740
|
//# sourceMappingURL=index.js.map
|