@bamboocss/parser 1.51.5 → 1.51.6
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 +43 -4
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +43 -4
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -1838,6 +1838,7 @@ var Project = class {
|
|
|
1838
1838
|
}
|
|
1839
1839
|
invalidateResolutions();
|
|
1840
1840
|
this.#resolver = void 0;
|
|
1841
|
+
this.#checkoutBoundaries = void 0;
|
|
1841
1842
|
this.#fileTreeRevision++;
|
|
1842
1843
|
this.sourcePreparations.clear();
|
|
1843
1844
|
};
|
|
@@ -1850,6 +1851,27 @@ var Project = class {
|
|
|
1850
1851
|
return specifier.startsWith(pattern.slice(0, wildcard)) && specifier.endsWith(pattern.slice(wildcard + 1));
|
|
1851
1852
|
});
|
|
1852
1853
|
};
|
|
1854
|
+
/**
|
|
1855
|
+
* Local candidates per *resolution*, rather than per importer that asks for one.
|
|
1856
|
+
*
|
|
1857
|
+
* `createResolver` memoizes by importing directory and specifier and hands back the same
|
|
1858
|
+
* `ResolvedModule` to every caller that lands on it — so the object identity is exactly the
|
|
1859
|
+
* unit this answer belongs to. Deriving it again per importer re-walked every failed lookup
|
|
1860
|
+
* a specifier produced, and canonicalised each one to place it in the checkout: a specifier
|
|
1861
|
+
* with fifty probes, imported by five hundred files, is twenty-five thousand repetitions of
|
|
1862
|
+
* a list that could not have changed.
|
|
1863
|
+
*
|
|
1864
|
+
* Keyed weakly so it lasts exactly as long as the resolution it describes; when the resolver
|
|
1865
|
+
* clears its memo the entries here become unreachable with it.
|
|
1866
|
+
*/
|
|
1867
|
+
#localCandidates = /* @__PURE__ */ new WeakMap();
|
|
1868
|
+
localCandidatesOf = (resolved) => {
|
|
1869
|
+
const remembered = this.#localCandidates.get(resolved);
|
|
1870
|
+
if (remembered) return remembered;
|
|
1871
|
+
const derived = this.getLocalFailedLookupCandidates(resolved.failedLookups);
|
|
1872
|
+
this.#localCandidates.set(resolved, derived);
|
|
1873
|
+
return derived;
|
|
1874
|
+
};
|
|
1853
1875
|
getLocalFailedLookupCandidates = (failedLookupLocations) => {
|
|
1854
1876
|
const seen = /* @__PURE__ */ new Set();
|
|
1855
1877
|
const candidates = [];
|
|
@@ -1864,12 +1886,29 @@ var Project = class {
|
|
|
1864
1886
|
return candidates;
|
|
1865
1887
|
};
|
|
1866
1888
|
isUnresolvedLocalSpecifier = (specifier, pendingCandidates) => specifier.startsWith(".") || specifier.startsWith("/") || this.isLocalAlias(specifier) || pendingCandidates.length > 0;
|
|
1867
|
-
|
|
1868
|
-
|
|
1889
|
+
/**
|
|
1890
|
+
* The checkout's two spellings, resolved once.
|
|
1891
|
+
*
|
|
1892
|
+
* Both are fixed for the life of the project — they come from `cwd` — and canonicalising the
|
|
1893
|
+
* root is a `realpath`, which is a `lstat` per path component. `isInCheckout` is asked once
|
|
1894
|
+
* per failed lookup a resolution produced, so recomputing the boundary there made half of
|
|
1895
|
+
* every such question a syscall walk over a path that had not moved since the last one.
|
|
1896
|
+
*
|
|
1897
|
+
* Invalidated wherever the resolver is, since a retargeted `cwd` moves the boundary too.
|
|
1898
|
+
*/
|
|
1899
|
+
#checkoutBoundaries;
|
|
1900
|
+
getCheckoutBoundaries = () => {
|
|
1901
|
+
if (this.#checkoutBoundaries) return this.#checkoutBoundaries;
|
|
1869
1902
|
const fileSystem = this.project.getFileSystem();
|
|
1870
1903
|
const configured = this.options.parserOptions.config.cwd;
|
|
1871
1904
|
const spelledRoot = this.normalizePath(configured || fileSystem.getCurrentDirectory()).replace(/\/$/, "");
|
|
1872
1905
|
const root = this.normalizePath(fileSystem.realpathSync(spelledRoot)).replace(/\/$/, "");
|
|
1906
|
+
return this.#checkoutBoundaries = [root, spelledRoot];
|
|
1907
|
+
};
|
|
1908
|
+
isInCheckout = (filePath) => {
|
|
1909
|
+
if (this.#sourceFiles.projectOptions.useInMemoryFileSystem) return true;
|
|
1910
|
+
const fileSystem = this.project.getFileSystem();
|
|
1911
|
+
const [root, spelledRoot] = this.getCheckoutBoundaries();
|
|
1873
1912
|
let target;
|
|
1874
1913
|
try {
|
|
1875
1914
|
target = this.normalizePath(fileSystem.realpathSync(filePath));
|
|
@@ -1877,7 +1916,7 @@ var Project = class {
|
|
|
1877
1916
|
if (!isMissingPathShapeError(error)) throw error;
|
|
1878
1917
|
target = this.normalizePath(filePath);
|
|
1879
1918
|
}
|
|
1880
|
-
return
|
|
1919
|
+
return target === root || target.startsWith(`${root}/`) || target === spelledRoot || target.startsWith(`${spelledRoot}/`);
|
|
1881
1920
|
};
|
|
1882
1921
|
/**
|
|
1883
1922
|
* Resolve one specifier, stopping short of installing what it names.
|
|
@@ -1923,7 +1962,7 @@ var Project = class {
|
|
|
1923
1962
|
paths: configured?.paths
|
|
1924
1963
|
});
|
|
1925
1964
|
for (const filePath of resolved.affectingFiles) recordConfigurationFile(filePath);
|
|
1926
|
-
const pendingCandidates = this.
|
|
1965
|
+
const pendingCandidates = this.localCandidatesOf(resolved);
|
|
1927
1966
|
const module = resolved.path ? {
|
|
1928
1967
|
resolvedFileName: resolved.path,
|
|
1929
1968
|
isExternalLibraryImport: resolved.path.includes("/node_modules/")
|
package/dist/index.d.cts
CHANGED
|
@@ -569,8 +569,10 @@ declare class Project {
|
|
|
569
569
|
*/
|
|
570
570
|
refreshResolutionConfiguration: (compilerOptions: CompilerOptions | undefined, resolutionConfigFiles: readonly string[], replaceCompilerOptions: boolean) => void;
|
|
571
571
|
private isLocalAlias;
|
|
572
|
+
private localCandidatesOf;
|
|
572
573
|
private getLocalFailedLookupCandidates;
|
|
573
574
|
private isUnresolvedLocalSpecifier;
|
|
575
|
+
private getCheckoutBoundaries;
|
|
574
576
|
private isInCheckout;
|
|
575
577
|
private retractImporter;
|
|
576
578
|
private publishResolutionFacts;
|
package/dist/index.d.mts
CHANGED
|
@@ -569,8 +569,10 @@ declare class Project {
|
|
|
569
569
|
*/
|
|
570
570
|
refreshResolutionConfiguration: (compilerOptions: CompilerOptions | undefined, resolutionConfigFiles: readonly string[], replaceCompilerOptions: boolean) => void;
|
|
571
571
|
private isLocalAlias;
|
|
572
|
+
private localCandidatesOf;
|
|
572
573
|
private getLocalFailedLookupCandidates;
|
|
573
574
|
private isUnresolvedLocalSpecifier;
|
|
575
|
+
private getCheckoutBoundaries;
|
|
574
576
|
private isInCheckout;
|
|
575
577
|
private retractImporter;
|
|
576
578
|
private publishResolutionFacts;
|
package/dist/index.mjs
CHANGED
|
@@ -1837,6 +1837,7 @@ var Project = class {
|
|
|
1837
1837
|
}
|
|
1838
1838
|
invalidateResolutions();
|
|
1839
1839
|
this.#resolver = void 0;
|
|
1840
|
+
this.#checkoutBoundaries = void 0;
|
|
1840
1841
|
this.#fileTreeRevision++;
|
|
1841
1842
|
this.sourcePreparations.clear();
|
|
1842
1843
|
};
|
|
@@ -1849,6 +1850,27 @@ var Project = class {
|
|
|
1849
1850
|
return specifier.startsWith(pattern.slice(0, wildcard)) && specifier.endsWith(pattern.slice(wildcard + 1));
|
|
1850
1851
|
});
|
|
1851
1852
|
};
|
|
1853
|
+
/**
|
|
1854
|
+
* Local candidates per *resolution*, rather than per importer that asks for one.
|
|
1855
|
+
*
|
|
1856
|
+
* `createResolver` memoizes by importing directory and specifier and hands back the same
|
|
1857
|
+
* `ResolvedModule` to every caller that lands on it — so the object identity is exactly the
|
|
1858
|
+
* unit this answer belongs to. Deriving it again per importer re-walked every failed lookup
|
|
1859
|
+
* a specifier produced, and canonicalised each one to place it in the checkout: a specifier
|
|
1860
|
+
* with fifty probes, imported by five hundred files, is twenty-five thousand repetitions of
|
|
1861
|
+
* a list that could not have changed.
|
|
1862
|
+
*
|
|
1863
|
+
* Keyed weakly so it lasts exactly as long as the resolution it describes; when the resolver
|
|
1864
|
+
* clears its memo the entries here become unreachable with it.
|
|
1865
|
+
*/
|
|
1866
|
+
#localCandidates = /* @__PURE__ */ new WeakMap();
|
|
1867
|
+
localCandidatesOf = (resolved) => {
|
|
1868
|
+
const remembered = this.#localCandidates.get(resolved);
|
|
1869
|
+
if (remembered) return remembered;
|
|
1870
|
+
const derived = this.getLocalFailedLookupCandidates(resolved.failedLookups);
|
|
1871
|
+
this.#localCandidates.set(resolved, derived);
|
|
1872
|
+
return derived;
|
|
1873
|
+
};
|
|
1852
1874
|
getLocalFailedLookupCandidates = (failedLookupLocations) => {
|
|
1853
1875
|
const seen = /* @__PURE__ */ new Set();
|
|
1854
1876
|
const candidates = [];
|
|
@@ -1863,12 +1885,29 @@ var Project = class {
|
|
|
1863
1885
|
return candidates;
|
|
1864
1886
|
};
|
|
1865
1887
|
isUnresolvedLocalSpecifier = (specifier, pendingCandidates) => specifier.startsWith(".") || specifier.startsWith("/") || this.isLocalAlias(specifier) || pendingCandidates.length > 0;
|
|
1866
|
-
|
|
1867
|
-
|
|
1888
|
+
/**
|
|
1889
|
+
* The checkout's two spellings, resolved once.
|
|
1890
|
+
*
|
|
1891
|
+
* Both are fixed for the life of the project — they come from `cwd` — and canonicalising the
|
|
1892
|
+
* root is a `realpath`, which is a `lstat` per path component. `isInCheckout` is asked once
|
|
1893
|
+
* per failed lookup a resolution produced, so recomputing the boundary there made half of
|
|
1894
|
+
* every such question a syscall walk over a path that had not moved since the last one.
|
|
1895
|
+
*
|
|
1896
|
+
* Invalidated wherever the resolver is, since a retargeted `cwd` moves the boundary too.
|
|
1897
|
+
*/
|
|
1898
|
+
#checkoutBoundaries;
|
|
1899
|
+
getCheckoutBoundaries = () => {
|
|
1900
|
+
if (this.#checkoutBoundaries) return this.#checkoutBoundaries;
|
|
1868
1901
|
const fileSystem = this.project.getFileSystem();
|
|
1869
1902
|
const configured = this.options.parserOptions.config.cwd;
|
|
1870
1903
|
const spelledRoot = this.normalizePath(configured || fileSystem.getCurrentDirectory()).replace(/\/$/, "");
|
|
1871
1904
|
const root = this.normalizePath(fileSystem.realpathSync(spelledRoot)).replace(/\/$/, "");
|
|
1905
|
+
return this.#checkoutBoundaries = [root, spelledRoot];
|
|
1906
|
+
};
|
|
1907
|
+
isInCheckout = (filePath) => {
|
|
1908
|
+
if (this.#sourceFiles.projectOptions.useInMemoryFileSystem) return true;
|
|
1909
|
+
const fileSystem = this.project.getFileSystem();
|
|
1910
|
+
const [root, spelledRoot] = this.getCheckoutBoundaries();
|
|
1872
1911
|
let target;
|
|
1873
1912
|
try {
|
|
1874
1913
|
target = this.normalizePath(fileSystem.realpathSync(filePath));
|
|
@@ -1876,7 +1915,7 @@ var Project = class {
|
|
|
1876
1915
|
if (!isMissingPathShapeError(error)) throw error;
|
|
1877
1916
|
target = this.normalizePath(filePath);
|
|
1878
1917
|
}
|
|
1879
|
-
return
|
|
1918
|
+
return target === root || target.startsWith(`${root}/`) || target === spelledRoot || target.startsWith(`${spelledRoot}/`);
|
|
1880
1919
|
};
|
|
1881
1920
|
/**
|
|
1882
1921
|
* Resolve one specifier, stopping short of installing what it names.
|
|
@@ -1922,7 +1961,7 @@ var Project = class {
|
|
|
1922
1961
|
paths: configured?.paths
|
|
1923
1962
|
});
|
|
1924
1963
|
for (const filePath of resolved.affectingFiles) recordConfigurationFile(filePath);
|
|
1925
|
-
const pendingCandidates = this.
|
|
1964
|
+
const pendingCandidates = this.localCandidatesOf(resolved);
|
|
1926
1965
|
const module = resolved.path ? {
|
|
1927
1966
|
resolvedFileName: resolved.path,
|
|
1928
1967
|
isExternalLibraryImport: resolved.path.includes("/node_modules/")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/parser",
|
|
3
|
-
"version": "1.51.
|
|
3
|
+
"version": "1.51.6",
|
|
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.51.
|
|
37
|
-
"@bamboocss/core": "^1.51.
|
|
38
|
-
"@bamboocss/extractor": "1.51.
|
|
39
|
-
"@bamboocss/logger": "1.51.
|
|
40
|
-
"@bamboocss/shared": "1.51.
|
|
41
|
-
"@bamboocss/ts-ast": "1.51.
|
|
42
|
-
"@bamboocss/types": "1.51.
|
|
36
|
+
"@bamboocss/config": "^1.51.6",
|
|
37
|
+
"@bamboocss/core": "^1.51.6",
|
|
38
|
+
"@bamboocss/extractor": "1.51.6",
|
|
39
|
+
"@bamboocss/logger": "1.51.6",
|
|
40
|
+
"@bamboocss/shared": "1.51.6",
|
|
41
|
+
"@bamboocss/ts-ast": "1.51.6",
|
|
42
|
+
"@bamboocss/types": "1.51.6"
|
|
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.51.
|
|
48
|
-
"@bamboocss/plugin-svelte": "1.51.
|
|
49
|
-
"@bamboocss/plugin-vue": "1.51.
|
|
47
|
+
"@bamboocss/generator": "1.51.6",
|
|
48
|
+
"@bamboocss/plugin-svelte": "1.51.6",
|
|
49
|
+
"@bamboocss/plugin-vue": "1.51.6"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsdown src/index.ts --format=esm,cjs --dts",
|