@bamboocss/parser 1.51.6 → 1.53.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.
- package/dist/index.cjs +41 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.mjs +41 -0
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -1511,6 +1511,22 @@ var Project = class {
|
|
|
1511
1511
|
this.#assertNotLoading();
|
|
1512
1512
|
return this.options.parserOptions;
|
|
1513
1513
|
}
|
|
1514
|
+
/**
|
|
1515
|
+
* `paths` and `baseUrl` as this project was configured with them, without opening a compiler.
|
|
1516
|
+
*
|
|
1517
|
+
* The same values `#planSpecifier` resolves against — read off the options the project was
|
|
1518
|
+
* built from rather than off the program, precisely so asking does not materialize one. A
|
|
1519
|
+
* caller that needs to know where a specifier could point *before* deciding what to install
|
|
1520
|
+
* has no compiler yet, and forcing one into existence to answer is the cost it is trying to
|
|
1521
|
+
* avoid.
|
|
1522
|
+
*/
|
|
1523
|
+
get resolutionOptions() {
|
|
1524
|
+
const configured = this.#sourceFiles.projectOptions.compilerOptions;
|
|
1525
|
+
return {
|
|
1526
|
+
baseUrl: configured?.baseUrl,
|
|
1527
|
+
paths: configured?.paths
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1514
1530
|
constructor(options) {
|
|
1515
1531
|
const { deferInitialSourceFiles, getFiles, parserOptions } = options;
|
|
1516
1532
|
const tsProjectOptions = { ...options };
|
|
@@ -2412,6 +2428,31 @@ var Project = class {
|
|
|
2412
2428
|
if (error?.code !== "ENOENT") throw error;
|
|
2413
2429
|
}
|
|
2414
2430
|
};
|
|
2431
|
+
/**
|
|
2432
|
+
* Install many sources at once, for the walk to find rather than for anything to parse.
|
|
2433
|
+
*
|
|
2434
|
+
* One membership change for the batch instead of one per file. That distinction is the whole
|
|
2435
|
+
* point: a file arriving on its own rewrites the synthesized config and makes the compiler
|
|
2436
|
+
* re-derive its program, which measured 409ms on a real application — so six hundred modules
|
|
2437
|
+
* reached by resolution cost four minutes that one bulk update would not.
|
|
2438
|
+
*
|
|
2439
|
+
* Files already held are skipped rather than overwritten, so this cannot displace text a
|
|
2440
|
+
* bundler installed or a hook rewrote. Nothing here is parsed; `parseSourceFile` still decides
|
|
2441
|
+
* that, and a caller that wants a file *extracted* puts it in `include`.
|
|
2442
|
+
*/
|
|
2443
|
+
addSourceFiles = (entries) => {
|
|
2444
|
+
this.#assertNotLoading();
|
|
2445
|
+
this.#ensureSourceFiles();
|
|
2446
|
+
const installed = [];
|
|
2447
|
+
for (const [filePath, content] of entries) {
|
|
2448
|
+
if (this.project.has(filePath)) continue;
|
|
2449
|
+
installed.push([filePath, content]);
|
|
2450
|
+
this.removedSourcePaths.delete(this.normalizePath(filePath));
|
|
2451
|
+
}
|
|
2452
|
+
if (!installed.length) return;
|
|
2453
|
+
this.project.addSourceFiles(installed);
|
|
2454
|
+
this.invalidate(true);
|
|
2455
|
+
};
|
|
2415
2456
|
addSourceFile = (filePath, content, options = {}) => {
|
|
2416
2457
|
this.#assertNotLoading();
|
|
2417
2458
|
this.#ensureSourceFiles();
|
package/dist/index.d.cts
CHANGED
|
@@ -471,6 +471,19 @@ declare class Project {
|
|
|
471
471
|
project: Project$1;
|
|
472
472
|
private options;
|
|
473
473
|
get parserOptions(): ParserOptions;
|
|
474
|
+
/**
|
|
475
|
+
* `paths` and `baseUrl` as this project was configured with them, without opening a compiler.
|
|
476
|
+
*
|
|
477
|
+
* The same values `#planSpecifier` resolves against — read off the options the project was
|
|
478
|
+
* built from rather than off the program, precisely so asking does not materialize one. A
|
|
479
|
+
* caller that needs to know where a specifier could point *before* deciding what to install
|
|
480
|
+
* has no compiler yet, and forcing one into existence to answer is the cost it is trying to
|
|
481
|
+
* avoid.
|
|
482
|
+
*/
|
|
483
|
+
get resolutionOptions(): {
|
|
484
|
+
baseUrl?: string;
|
|
485
|
+
paths?: Record<string, string[]>;
|
|
486
|
+
};
|
|
474
487
|
constructor(options: ProjectOptions);
|
|
475
488
|
get files(): string[];
|
|
476
489
|
/** Reverse dependency graph: resolved target -> importers. */
|
|
@@ -628,6 +641,19 @@ declare class Project {
|
|
|
628
641
|
getResolutionConfigurationFiles: (filePath: string, targets?: Iterable<string>, previous?: Iterable<string>) => readonly string[];
|
|
629
642
|
createSourceFile: (filePath: string) => SourceFile;
|
|
630
643
|
createSourceFiles: () => void;
|
|
644
|
+
/**
|
|
645
|
+
* Install many sources at once, for the walk to find rather than for anything to parse.
|
|
646
|
+
*
|
|
647
|
+
* One membership change for the batch instead of one per file. That distinction is the whole
|
|
648
|
+
* point: a file arriving on its own rewrites the synthesized config and makes the compiler
|
|
649
|
+
* re-derive its program, which measured 409ms on a real application — so six hundred modules
|
|
650
|
+
* reached by resolution cost four minutes that one bulk update would not.
|
|
651
|
+
*
|
|
652
|
+
* Files already held are skipped rather than overwritten, so this cannot displace text a
|
|
653
|
+
* bundler installed or a hook rewrote. Nothing here is parsed; `parseSourceFile` still decides
|
|
654
|
+
* that, and a caller that wants a file *extracted* puts it in `include`.
|
|
655
|
+
*/
|
|
656
|
+
addSourceFiles: (entries: Iterable<readonly [string, string]>) => void;
|
|
631
657
|
addSourceFile: (filePath: string, content: string, options?: AddSourceFileOptions) => SourceFile;
|
|
632
658
|
/** Claim or release compiler ownership of one source, in the ledger's own spelling. */
|
|
633
659
|
private markAuxiliary;
|
package/dist/index.d.mts
CHANGED
|
@@ -471,6 +471,19 @@ declare class Project {
|
|
|
471
471
|
project: Project$1;
|
|
472
472
|
private options;
|
|
473
473
|
get parserOptions(): ParserOptions;
|
|
474
|
+
/**
|
|
475
|
+
* `paths` and `baseUrl` as this project was configured with them, without opening a compiler.
|
|
476
|
+
*
|
|
477
|
+
* The same values `#planSpecifier` resolves against — read off the options the project was
|
|
478
|
+
* built from rather than off the program, precisely so asking does not materialize one. A
|
|
479
|
+
* caller that needs to know where a specifier could point *before* deciding what to install
|
|
480
|
+
* has no compiler yet, and forcing one into existence to answer is the cost it is trying to
|
|
481
|
+
* avoid.
|
|
482
|
+
*/
|
|
483
|
+
get resolutionOptions(): {
|
|
484
|
+
baseUrl?: string;
|
|
485
|
+
paths?: Record<string, string[]>;
|
|
486
|
+
};
|
|
474
487
|
constructor(options: ProjectOptions);
|
|
475
488
|
get files(): string[];
|
|
476
489
|
/** Reverse dependency graph: resolved target -> importers. */
|
|
@@ -628,6 +641,19 @@ declare class Project {
|
|
|
628
641
|
getResolutionConfigurationFiles: (filePath: string, targets?: Iterable<string>, previous?: Iterable<string>) => readonly string[];
|
|
629
642
|
createSourceFile: (filePath: string) => SourceFile;
|
|
630
643
|
createSourceFiles: () => void;
|
|
644
|
+
/**
|
|
645
|
+
* Install many sources at once, for the walk to find rather than for anything to parse.
|
|
646
|
+
*
|
|
647
|
+
* One membership change for the batch instead of one per file. That distinction is the whole
|
|
648
|
+
* point: a file arriving on its own rewrites the synthesized config and makes the compiler
|
|
649
|
+
* re-derive its program, which measured 409ms on a real application — so six hundred modules
|
|
650
|
+
* reached by resolution cost four minutes that one bulk update would not.
|
|
651
|
+
*
|
|
652
|
+
* Files already held are skipped rather than overwritten, so this cannot displace text a
|
|
653
|
+
* bundler installed or a hook rewrote. Nothing here is parsed; `parseSourceFile` still decides
|
|
654
|
+
* that, and a caller that wants a file *extracted* puts it in `include`.
|
|
655
|
+
*/
|
|
656
|
+
addSourceFiles: (entries: Iterable<readonly [string, string]>) => void;
|
|
631
657
|
addSourceFile: (filePath: string, content: string, options?: AddSourceFileOptions) => SourceFile;
|
|
632
658
|
/** Claim or release compiler ownership of one source, in the ledger's own spelling. */
|
|
633
659
|
private markAuxiliary;
|
package/dist/index.mjs
CHANGED
|
@@ -1510,6 +1510,22 @@ var Project = class {
|
|
|
1510
1510
|
this.#assertNotLoading();
|
|
1511
1511
|
return this.options.parserOptions;
|
|
1512
1512
|
}
|
|
1513
|
+
/**
|
|
1514
|
+
* `paths` and `baseUrl` as this project was configured with them, without opening a compiler.
|
|
1515
|
+
*
|
|
1516
|
+
* The same values `#planSpecifier` resolves against — read off the options the project was
|
|
1517
|
+
* built from rather than off the program, precisely so asking does not materialize one. A
|
|
1518
|
+
* caller that needs to know where a specifier could point *before* deciding what to install
|
|
1519
|
+
* has no compiler yet, and forcing one into existence to answer is the cost it is trying to
|
|
1520
|
+
* avoid.
|
|
1521
|
+
*/
|
|
1522
|
+
get resolutionOptions() {
|
|
1523
|
+
const configured = this.#sourceFiles.projectOptions.compilerOptions;
|
|
1524
|
+
return {
|
|
1525
|
+
baseUrl: configured?.baseUrl,
|
|
1526
|
+
paths: configured?.paths
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1513
1529
|
constructor(options) {
|
|
1514
1530
|
const { deferInitialSourceFiles, getFiles, parserOptions } = options;
|
|
1515
1531
|
const tsProjectOptions = { ...options };
|
|
@@ -2411,6 +2427,31 @@ var Project = class {
|
|
|
2411
2427
|
if (error?.code !== "ENOENT") throw error;
|
|
2412
2428
|
}
|
|
2413
2429
|
};
|
|
2430
|
+
/**
|
|
2431
|
+
* Install many sources at once, for the walk to find rather than for anything to parse.
|
|
2432
|
+
*
|
|
2433
|
+
* One membership change for the batch instead of one per file. That distinction is the whole
|
|
2434
|
+
* point: a file arriving on its own rewrites the synthesized config and makes the compiler
|
|
2435
|
+
* re-derive its program, which measured 409ms on a real application — so six hundred modules
|
|
2436
|
+
* reached by resolution cost four minutes that one bulk update would not.
|
|
2437
|
+
*
|
|
2438
|
+
* Files already held are skipped rather than overwritten, so this cannot displace text a
|
|
2439
|
+
* bundler installed or a hook rewrote. Nothing here is parsed; `parseSourceFile` still decides
|
|
2440
|
+
* that, and a caller that wants a file *extracted* puts it in `include`.
|
|
2441
|
+
*/
|
|
2442
|
+
addSourceFiles = (entries) => {
|
|
2443
|
+
this.#assertNotLoading();
|
|
2444
|
+
this.#ensureSourceFiles();
|
|
2445
|
+
const installed = [];
|
|
2446
|
+
for (const [filePath, content] of entries) {
|
|
2447
|
+
if (this.project.has(filePath)) continue;
|
|
2448
|
+
installed.push([filePath, content]);
|
|
2449
|
+
this.removedSourcePaths.delete(this.normalizePath(filePath));
|
|
2450
|
+
}
|
|
2451
|
+
if (!installed.length) return;
|
|
2452
|
+
this.project.addSourceFiles(installed);
|
|
2453
|
+
this.invalidate(true);
|
|
2454
|
+
};
|
|
2414
2455
|
addSourceFile = (filePath, content, options = {}) => {
|
|
2415
2456
|
this.#assertNotLoading();
|
|
2416
2457
|
this.#ensureSourceFiles();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/parser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.0",
|
|
4
4
|
"description": "The static parser for bamboo css",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"ts-pattern": "5.9.0",
|
|
36
|
-
"@bamboocss/config": "^1.
|
|
37
|
-
"@bamboocss/core": "^1.
|
|
38
|
-
"@bamboocss/extractor": "1.
|
|
39
|
-
"@bamboocss/logger": "1.
|
|
40
|
-
"@bamboocss/shared": "1.
|
|
41
|
-
"@bamboocss/ts-ast": "1.
|
|
42
|
-
"@bamboocss/types": "1.
|
|
36
|
+
"@bamboocss/config": "^1.53.0",
|
|
37
|
+
"@bamboocss/core": "^1.53.0",
|
|
38
|
+
"@bamboocss/extractor": "1.53.0",
|
|
39
|
+
"@bamboocss/logger": "1.53.0",
|
|
40
|
+
"@bamboocss/shared": "1.53.0",
|
|
41
|
+
"@bamboocss/ts-ast": "1.53.0",
|
|
42
|
+
"@bamboocss/types": "1.53.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@typescript/api": "npm:typescript@7.1.0-dev.20260826.1",
|
|
46
46
|
"ts-morph": "28.0.0",
|
|
47
|
-
"@bamboocss/generator": "1.
|
|
48
|
-
"@bamboocss/plugin-svelte": "1.
|
|
49
|
-
"@bamboocss/plugin-vue": "1.
|
|
47
|
+
"@bamboocss/generator": "1.53.0",
|
|
48
|
+
"@bamboocss/plugin-svelte": "1.53.0",
|
|
49
|
+
"@bamboocss/plugin-vue": "1.53.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsdown src/index.ts --format=esm,cjs --dts",
|