weapp-tailwindcss 5.0.7 → 5.0.10
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/auto-CTp6wE5a.js +33 -0
- package/dist/auto-Cl8_hsG6.mjs +22 -0
- package/dist/{bundle-state-BzwPS-UI.js → bundle-state-BwtEqxvU.js} +3 -3
- package/dist/{bundle-state-ChcOKb9w.mjs → bundle-state-CXzPknlT.mjs} +2 -2
- package/dist/bundlers/vite/official-tailwind-plugins.d.ts +0 -2
- package/dist/cli.js +3 -159
- package/dist/cli.mjs +3 -159
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +1 -7
- package/dist/css-macro/postcss.d.ts +1 -6
- package/dist/css-macro/postcss.js +15 -3
- package/dist/css-macro/postcss.mjs +2 -2
- package/dist/css-macro.js +19 -5
- package/dist/css-macro.mjs +16 -2
- package/dist/{generator-6yF8wjxR.js → generator-ChgOWNOj.js} +1 -1
- package/dist/{generator-BON6M1bL.mjs → generator-h2XRiJ9-.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-oE-Byqk6.mjs → gulp-Be88jhoY.mjs} +5 -5
- package/dist/{gulp-_7p1Z2vc.js → gulp-CHtZF-oT.js} +6 -6
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BKQNRxHr.js → hmr-timing-BkivBZvN.js} +41 -43
- package/dist/{hmr-timing-BVTGf5ch.mjs → hmr-timing-Ct5w4hdM.mjs} +6 -7
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/postcss.d.ts +2 -13
- package/dist/postcss.js +14 -3
- package/dist/postcss.mjs +10 -1
- package/dist/{precheck-CZjr87m_.mjs → precheck-BpHxsWRd.mjs} +4 -4
- package/dist/{precheck-fhIkzCSU.js → precheck-CY9oaH49.js} +5 -5
- package/dist/presets.js +4 -4
- package/dist/presets.mjs +3 -3
- package/dist/tailwindcss/source-scan/inline-source.d.ts +1 -1
- package/dist/{tailwindcss-bbQUg25J.mjs → tailwindcss-Bfy2egdX.mjs} +2 -2
- package/dist/{tailwindcss-vswd1gc3.js → tailwindcss-DbbAKAZP.js} +3 -3
- package/dist/{transform-CReJxxh_.js → transform-Cd634UZV.js} +1 -1
- package/dist/{transform-DEsFlG9k.mjs → transform-r5evL6Hn.mjs} +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/{v3-engine-CdIwmHuc.mjs → v3-engine-CFkP6dWF.mjs} +55 -19
- package/dist/{v3-engine-CEMXFegG.js → v3-engine-D0yA9ZkF.js} +86 -87
- package/dist/{vite-C7BGAlCE.mjs → vite-BM_iIFmS.mjs} +10 -411
- package/dist/{vite-0jFbh9hx.js → vite-Bh-BNp5g.js} +27 -431
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/watch-dependencies-bpG6kmAf.js +80 -0
- package/dist/weapp-tw-css-import-rewrite-loader.js +111 -407
- package/dist/weapp-tw-runtime-classset-loader.js +2 -2
- package/dist/{webpack-aEuDoYfQ.js → webpack-CJAOcYEO.js} +16 -9
- package/dist/{webpack-Dx6_eg5k.mjs → webpack-DPdrcC2X.mjs} +15 -8
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +5 -7
- package/dist/auto-Cvy0zWpS.js +0 -238
- package/dist/auto-DEHRmEAx.mjs +0 -200
- package/dist/bundlers/vite/postcss-config.d.ts +0 -6
- package/dist/bundlers/vite/processed-css-assets/css-rules.d.ts +0 -17
- package/dist/postcss/config-directive.d.ts +0 -1
- package/dist/postcss/context.d.ts +0 -9
- package/dist/postcss/source-files.d.ts +0 -8
- package/dist/postcss/tailwind-version.d.ts +0 -3
- package/dist/postcss-BTIunhWl.js +0 -284
- package/dist/postcss-BtmrrZ31.mjs +0 -275
- package/dist/postcss-C7BMYpEF.mjs +0 -169
- package/dist/postcss-CiYLsqZn.js +0 -192
- package/dist/watch-dependencies-zwx4EhBn.js +0 -5535
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-D0yA9ZkF.js");
|
|
3
|
+
const require_generator = require("./generator-ChgOWNOj.js");
|
|
4
|
+
const require_precheck = require("./precheck-CY9oaH49.js");
|
|
5
5
|
const require_utils = require("./utils-Dolmt8EO.js");
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
8
|
-
const require_bundle_state = require("./bundle-state-
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-DbbAKAZP.js");
|
|
7
|
+
const require_hmr_timing = require("./hmr-timing-BkivBZvN.js");
|
|
8
|
+
const require_bundle_state = require("./bundle-state-BwtEqxvU.js");
|
|
9
9
|
require("./logger-TlKT3xmR.js");
|
|
10
|
-
let
|
|
11
|
-
postcss = require_chunk.__toESM(postcss);
|
|
10
|
+
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
12
11
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
13
|
-
let node_process = require("node:process");
|
|
14
|
-
node_process = require_chunk.__toESM(node_process);
|
|
15
12
|
let node_fs = require("node:fs");
|
|
16
13
|
node_fs = require_chunk.__toESM(node_fs);
|
|
17
14
|
let node_path = require("node:path");
|
|
18
15
|
node_path = require_chunk.__toESM(node_path);
|
|
16
|
+
let node_process = require("node:process");
|
|
17
|
+
node_process = require_chunk.__toESM(node_process);
|
|
19
18
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
20
19
|
let node_fs_promises = require("node:fs/promises");
|
|
21
20
|
let node_buffer = require("node:buffer");
|
|
22
21
|
let _weapp_tailwindcss_postcss_html_transform = require("@weapp-tailwindcss/postcss/html-transform");
|
|
23
22
|
_weapp_tailwindcss_postcss_html_transform = require_chunk.__toESM(_weapp_tailwindcss_postcss_html_transform);
|
|
24
23
|
let comment_json = require("comment-json");
|
|
25
|
-
let postcss_selector_parser = require("postcss-selector-parser");
|
|
26
|
-
postcss_selector_parser = require_chunk.__toESM(postcss_selector_parser);
|
|
27
|
-
let postcss_load_config = require("postcss-load-config");
|
|
28
|
-
postcss_load_config = require_chunk.__toESM(postcss_load_config);
|
|
29
24
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
30
25
|
//#region src/uni-app-x/harmony.ts
|
|
31
26
|
function isUniAppXHarmonyOutDir(outDir) {
|
|
@@ -151,7 +146,7 @@ function createUtsStyleArrayFromAppStyles(code, appSource) {
|
|
|
151
146
|
function cssToStyleExport(source) {
|
|
152
147
|
let root;
|
|
153
148
|
try {
|
|
154
|
-
root = postcss.
|
|
149
|
+
root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
155
150
|
} catch {
|
|
156
151
|
return;
|
|
157
152
|
}
|
|
@@ -194,7 +189,7 @@ function createStyleValueFromApplySources(sources, utilityStyles) {
|
|
|
194
189
|
for (const styleSource of styleSources) {
|
|
195
190
|
let root;
|
|
196
191
|
try {
|
|
197
|
-
root = postcss.
|
|
192
|
+
root = _weapp_tailwindcss_postcss.postcss.parse(styleSource);
|
|
198
193
|
} catch {
|
|
199
194
|
continue;
|
|
200
195
|
}
|
|
@@ -230,7 +225,7 @@ function collectUniAppXHarmonyApplyUtilitiesFromSources(sources) {
|
|
|
230
225
|
for (const source of sources) for (const styleSource of collectUniAppXHarmonyApplyStyleSourcesFromSource(source)) {
|
|
231
226
|
let root;
|
|
232
227
|
try {
|
|
233
|
-
root = postcss.
|
|
228
|
+
root = _weapp_tailwindcss_postcss.postcss.parse(styleSource);
|
|
234
229
|
} catch {
|
|
235
230
|
continue;
|
|
236
231
|
}
|
|
@@ -485,7 +480,7 @@ function resolveUniAppXStyleIsolationEnabled(root) {
|
|
|
485
480
|
//#region src/uni-app-x/vite.ts
|
|
486
481
|
let transformUVuePromise;
|
|
487
482
|
function loadTransformUVue() {
|
|
488
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
483
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-Cd634UZV.js")).then((mod) => mod.transformUVue));
|
|
489
484
|
return transformUVuePromise;
|
|
490
485
|
}
|
|
491
486
|
const preprocessorLangs = new Set([
|
|
@@ -812,7 +807,7 @@ function resolveViteCssPipelineOutputFile(file, _opts, rootDir, isWebGeneratorTa
|
|
|
812
807
|
function canProcessViteSourceStyleAsCss(source, file) {
|
|
813
808
|
if (SOURCE_STYLE_NON_CSS_SYNTAX_RE.test(source)) return false;
|
|
814
809
|
try {
|
|
815
|
-
postcss.
|
|
810
|
+
_weapp_tailwindcss_postcss.postcss.parse(source, { from: file });
|
|
816
811
|
return true;
|
|
817
812
|
} catch {
|
|
818
813
|
return false;
|
|
@@ -1883,363 +1878,6 @@ const mix = (del = delimiter) => {
|
|
|
1883
1878
|
const posix = /* @__PURE__ */ mix(":");
|
|
1884
1879
|
const win32 = /* @__PURE__ */ mix(";");
|
|
1885
1880
|
//#endregion
|
|
1886
|
-
//#region src/bundlers/vite/processed-css-assets/css-rules.ts
|
|
1887
|
-
const MINI_PROGRAM_PREFLIGHT_SELECTOR_KEY = "view,text,::after,::before";
|
|
1888
|
-
const MINI_PROGRAM_PREFLIGHT_SELECTOR_KEYS = new Set([
|
|
1889
|
-
"view",
|
|
1890
|
-
"text",
|
|
1891
|
-
"::after",
|
|
1892
|
-
"::before"
|
|
1893
|
-
]);
|
|
1894
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTOR_KEY = ":host,page,.tw-root,wx-root-portal-content";
|
|
1895
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTOR_KEYS = new Set([
|
|
1896
|
-
":host",
|
|
1897
|
-
"page",
|
|
1898
|
-
".tw-root",
|
|
1899
|
-
"wx-root-portal-content"
|
|
1900
|
-
]);
|
|
1901
|
-
function normalizeCssForContainment(css) {
|
|
1902
|
-
return css.replace(/\/\*[\s\S]*?\*\//g, "").replace(/::(before|after)\b/g, ":$1").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~()])\s*/g, "$1").replace(/;\}/g, "}").trim();
|
|
1903
|
-
}
|
|
1904
|
-
function collectNormalizedCssNodes(css) {
|
|
1905
|
-
try {
|
|
1906
|
-
return (postcss.default.parse(css).nodes ?? []).filter((node) => node.type !== "comment").map((node) => normalizeCssForContainment(node.toString())).filter(Boolean);
|
|
1907
|
-
} catch {
|
|
1908
|
-
const normalizedCss = normalizeCssForContainment(css);
|
|
1909
|
-
return normalizedCss ? [normalizedCss] : [];
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
function normalizeCssRuleKeyPart(value) {
|
|
1913
|
-
return value.replace(/::(before|after)\b/g, ":$1").replace(/\s+/g, " ").replace(/\s*([>+~(),])\s*/g, "$1").trim();
|
|
1914
|
-
}
|
|
1915
|
-
function getRuleAtRuleChain(rule) {
|
|
1916
|
-
const chain = [];
|
|
1917
|
-
let parent = rule.parent;
|
|
1918
|
-
while (parent && parent.type !== "root") {
|
|
1919
|
-
if (parent.type === "atrule") chain.unshift(`@${parent.name} ${normalizeCssRuleKeyPart(parent.params)}`);
|
|
1920
|
-
parent = parent.parent;
|
|
1921
|
-
}
|
|
1922
|
-
return chain;
|
|
1923
|
-
}
|
|
1924
|
-
function getCssRuleStructuralKey(rule) {
|
|
1925
|
-
const selector = normalizeCssRuleKeyPart(rule.selector);
|
|
1926
|
-
if (selector.length === 0) return;
|
|
1927
|
-
return [...getRuleAtRuleChain(rule), selector].join("|");
|
|
1928
|
-
}
|
|
1929
|
-
function getCssRuleStructuralKeyWithSelectorKey(rule, selectorKey) {
|
|
1930
|
-
return [...getRuleAtRuleChain(rule), selectorKey].join("|");
|
|
1931
|
-
}
|
|
1932
|
-
function getCssRuleContentKey(rule) {
|
|
1933
|
-
const structuralKey = getCssRuleStructuralKey(rule);
|
|
1934
|
-
if (!structuralKey) return;
|
|
1935
|
-
return [structuralKey, normalizeCssForContainment(rule.toString())].join("|");
|
|
1936
|
-
}
|
|
1937
|
-
function collectCssRuleContentKeys(css) {
|
|
1938
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1939
|
-
try {
|
|
1940
|
-
postcss.default.parse(css).walkRules((rule) => {
|
|
1941
|
-
const key = getCssRuleContentKey(rule);
|
|
1942
|
-
if (key) keys.add(key);
|
|
1943
|
-
});
|
|
1944
|
-
} catch {}
|
|
1945
|
-
return keys;
|
|
1946
|
-
}
|
|
1947
|
-
function normalizeCssDeclarationKey(decl) {
|
|
1948
|
-
return [
|
|
1949
|
-
decl.prop.trim(),
|
|
1950
|
-
normalizeCssForContainment(decl.value),
|
|
1951
|
-
decl.important ? "!important" : ""
|
|
1952
|
-
].join(":");
|
|
1953
|
-
}
|
|
1954
|
-
function collectCssRuleDeclarationKeys(rule) {
|
|
1955
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1956
|
-
for (const node of rule.nodes ?? []) if (node.type === "decl") keys.add(normalizeCssDeclarationKey(node));
|
|
1957
|
-
return keys;
|
|
1958
|
-
}
|
|
1959
|
-
function collectCssRuleDeclarationProps(rule) {
|
|
1960
|
-
const props = /* @__PURE__ */ new Set();
|
|
1961
|
-
for (const node of rule.nodes ?? []) if (node.type === "decl") props.add(node.prop.trim());
|
|
1962
|
-
return props;
|
|
1963
|
-
}
|
|
1964
|
-
function collectCssRuleDeclarations(rule) {
|
|
1965
|
-
return (rule.nodes ?? []).filter((node) => node.type === "decl");
|
|
1966
|
-
}
|
|
1967
|
-
function collectCssRuleDeclarationKeyMap(css) {
|
|
1968
|
-
const map = /* @__PURE__ */ new Map();
|
|
1969
|
-
try {
|
|
1970
|
-
postcss.default.parse(css).walkRules((rule) => {
|
|
1971
|
-
const key = getCssRuleStructuralKey(rule);
|
|
1972
|
-
if (!key) return;
|
|
1973
|
-
const declarations = collectCssRuleDeclarationKeys(rule);
|
|
1974
|
-
if (declarations.size === 0) return;
|
|
1975
|
-
let existing = map.get(key);
|
|
1976
|
-
if (!existing) {
|
|
1977
|
-
existing = /* @__PURE__ */ new Set();
|
|
1978
|
-
map.set(key, existing);
|
|
1979
|
-
}
|
|
1980
|
-
for (const declaration of declarations) existing.add(declaration);
|
|
1981
|
-
});
|
|
1982
|
-
} catch {}
|
|
1983
|
-
return map;
|
|
1984
|
-
}
|
|
1985
|
-
function collectCssRuleDeclarationRecords(root, resolveRuleKey = getCssRuleStructuralKey) {
|
|
1986
|
-
const map = /* @__PURE__ */ new Map();
|
|
1987
|
-
root.walkRules((rule) => {
|
|
1988
|
-
const key = resolveRuleKey(rule);
|
|
1989
|
-
if (!key) return;
|
|
1990
|
-
const keys = collectCssRuleDeclarationKeys(rule);
|
|
1991
|
-
if (keys.size === 0) return;
|
|
1992
|
-
const records = map.get(key) ?? [];
|
|
1993
|
-
records.push({
|
|
1994
|
-
rule,
|
|
1995
|
-
keys,
|
|
1996
|
-
props: collectCssRuleDeclarationProps(rule)
|
|
1997
|
-
});
|
|
1998
|
-
map.set(key, records);
|
|
1999
|
-
});
|
|
2000
|
-
return map;
|
|
2001
|
-
}
|
|
2002
|
-
function normalizeSimpleMiniProgramSelectorNode(node) {
|
|
2003
|
-
if (node.type === "tag") {
|
|
2004
|
-
const value = node.value.toLowerCase();
|
|
2005
|
-
if (value === "view" || value === "text" || value === "page" || value === "wx-root-portal-content") return value;
|
|
2006
|
-
return;
|
|
2007
|
-
}
|
|
2008
|
-
if (node.type === "class") return node.value.toLowerCase() === "tw-root" ? ".tw-root" : void 0;
|
|
2009
|
-
if (node.type === "pseudo") {
|
|
2010
|
-
if (node.nodes && node.nodes.length > 0) return;
|
|
2011
|
-
const value = node.value.toLowerCase();
|
|
2012
|
-
if (value === ":before" || value === "::before") return "::before";
|
|
2013
|
-
if (value === ":after" || value === "::after") return "::after";
|
|
2014
|
-
if (value === ":host") return ":host";
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
function normalizeSimpleMiniProgramSelector(selector) {
|
|
2018
|
-
if (selector.nodes.length !== 1) return;
|
|
2019
|
-
return normalizeSimpleMiniProgramSelectorNode(selector.nodes[0]);
|
|
2020
|
-
}
|
|
2021
|
-
function collectMiniProgramSelectorSet(selector) {
|
|
2022
|
-
try {
|
|
2023
|
-
const selectorSet = /* @__PURE__ */ new Set();
|
|
2024
|
-
const ast = (0, postcss_selector_parser.default)().astSync(selector);
|
|
2025
|
-
for (const child of ast.nodes) {
|
|
2026
|
-
const key = normalizeSimpleMiniProgramSelector(child);
|
|
2027
|
-
if (!key || selectorSet.has(key)) return;
|
|
2028
|
-
selectorSet.add(key);
|
|
2029
|
-
}
|
|
2030
|
-
return selectorSet;
|
|
2031
|
-
} catch {
|
|
2032
|
-
return;
|
|
2033
|
-
}
|
|
2034
|
-
}
|
|
2035
|
-
function isSameSelectorSet(actual, expected) {
|
|
2036
|
-
return actual?.size === expected.size && [...expected].every((key) => actual.has(key));
|
|
2037
|
-
}
|
|
2038
|
-
function getMiniProgramPreflightRuleStructuralKey(rule) {
|
|
2039
|
-
if (!isSameSelectorSet(collectMiniProgramSelectorSet(rule.selector), MINI_PROGRAM_PREFLIGHT_SELECTOR_KEYS)) return;
|
|
2040
|
-
return getCssRuleStructuralKeyWithSelectorKey(rule, MINI_PROGRAM_PREFLIGHT_SELECTOR_KEY);
|
|
2041
|
-
}
|
|
2042
|
-
function getMiniProgramThemeScopeRuleStructuralKey(rule) {
|
|
2043
|
-
if (!isSameSelectorSet(collectMiniProgramSelectorSet(rule.selector), MINI_PROGRAM_THEME_SCOPE_SELECTOR_KEYS)) return;
|
|
2044
|
-
return getCssRuleStructuralKeyWithSelectorKey(rule, MINI_PROGRAM_THEME_SCOPE_SELECTOR_KEY);
|
|
2045
|
-
}
|
|
2046
|
-
function mergeMiniProgramPreflightRuleDeclarations(baseCss, css) {
|
|
2047
|
-
try {
|
|
2048
|
-
const baseRoot = postcss.default.parse(baseCss);
|
|
2049
|
-
const root = postcss.default.parse(css);
|
|
2050
|
-
const baseRuleRecords = collectCssRuleDeclarationRecords(baseRoot, getMiniProgramPreflightRuleStructuralKey);
|
|
2051
|
-
let changedBase = false;
|
|
2052
|
-
let changedCss = false;
|
|
2053
|
-
root.walkRules((rule) => {
|
|
2054
|
-
const key = getMiniProgramPreflightRuleStructuralKey(rule);
|
|
2055
|
-
if (!key) return;
|
|
2056
|
-
const records = baseRuleRecords.get(key);
|
|
2057
|
-
const targetRecord = records?.[0];
|
|
2058
|
-
if (!targetRecord) return;
|
|
2059
|
-
const existingProps = new Set(records.flatMap((record) => [...record.props]));
|
|
2060
|
-
for (const decl of collectCssRuleDeclarations(rule)) {
|
|
2061
|
-
const prop = decl.prop.trim();
|
|
2062
|
-
if (existingProps.has(prop)) continue;
|
|
2063
|
-
targetRecord.rule.append(decl.clone());
|
|
2064
|
-
targetRecord.keys.add(normalizeCssDeclarationKey(decl));
|
|
2065
|
-
targetRecord.props.add(prop);
|
|
2066
|
-
existingProps.add(prop);
|
|
2067
|
-
changedBase = true;
|
|
2068
|
-
}
|
|
2069
|
-
rule.remove();
|
|
2070
|
-
changedCss = true;
|
|
2071
|
-
});
|
|
2072
|
-
if (!changedBase && !changedCss) return {
|
|
2073
|
-
baseCss,
|
|
2074
|
-
css,
|
|
2075
|
-
changed: false
|
|
2076
|
-
};
|
|
2077
|
-
removeEmptyAtRules(root);
|
|
2078
|
-
return {
|
|
2079
|
-
baseCss: changedBase ? baseRoot.toString() : baseCss,
|
|
2080
|
-
css: changedCss ? root.toString().trim() : css,
|
|
2081
|
-
changed: true
|
|
2082
|
-
};
|
|
2083
|
-
} catch {
|
|
2084
|
-
return {
|
|
2085
|
-
baseCss,
|
|
2086
|
-
css,
|
|
2087
|
-
changed: false
|
|
2088
|
-
};
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
function mergeMiniProgramThemeScopeRuleDeclarations(baseCss, css) {
|
|
2092
|
-
try {
|
|
2093
|
-
const baseRoot = postcss.default.parse(baseCss);
|
|
2094
|
-
const root = postcss.default.parse(css);
|
|
2095
|
-
const baseRuleRecords = collectCssRuleDeclarationRecords(baseRoot, getMiniProgramThemeScopeRuleStructuralKey);
|
|
2096
|
-
let changedBase = false;
|
|
2097
|
-
let changedCss = false;
|
|
2098
|
-
root.walkRules((rule) => {
|
|
2099
|
-
const key = getMiniProgramThemeScopeRuleStructuralKey(rule);
|
|
2100
|
-
if (!key) return;
|
|
2101
|
-
const records = baseRuleRecords.get(key);
|
|
2102
|
-
const targetRecord = records?.[0];
|
|
2103
|
-
if (!targetRecord) return;
|
|
2104
|
-
const incomingDeclarations = collectCssRuleDeclarations(rule);
|
|
2105
|
-
if (incomingDeclarations.length === 0) return;
|
|
2106
|
-
const existingKeys = new Set(records.flatMap((record) => [...record.keys]));
|
|
2107
|
-
const existingProps = new Set(records.flatMap((record) => [...record.props]));
|
|
2108
|
-
if (incomingDeclarations.some((decl) => {
|
|
2109
|
-
const prop = decl.prop.trim();
|
|
2110
|
-
return existingProps.has(prop) && !existingKeys.has(normalizeCssDeclarationKey(decl));
|
|
2111
|
-
})) return;
|
|
2112
|
-
for (const decl of incomingDeclarations) {
|
|
2113
|
-
const declarationKey = normalizeCssDeclarationKey(decl);
|
|
2114
|
-
if (existingKeys.has(declarationKey)) continue;
|
|
2115
|
-
targetRecord.rule.append(decl.clone());
|
|
2116
|
-
targetRecord.keys.add(declarationKey);
|
|
2117
|
-
targetRecord.props.add(decl.prop.trim());
|
|
2118
|
-
existingKeys.add(declarationKey);
|
|
2119
|
-
existingProps.add(decl.prop.trim());
|
|
2120
|
-
changedBase = true;
|
|
2121
|
-
}
|
|
2122
|
-
rule.remove();
|
|
2123
|
-
changedCss = true;
|
|
2124
|
-
});
|
|
2125
|
-
if (!changedBase && !changedCss) return {
|
|
2126
|
-
baseCss,
|
|
2127
|
-
css,
|
|
2128
|
-
changed: false
|
|
2129
|
-
};
|
|
2130
|
-
removeEmptyAtRules(root);
|
|
2131
|
-
return {
|
|
2132
|
-
baseCss: changedBase ? baseRoot.toString() : baseCss,
|
|
2133
|
-
css: changedCss ? root.toString().trim() : css,
|
|
2134
|
-
changed: true
|
|
2135
|
-
};
|
|
2136
|
-
} catch {
|
|
2137
|
-
return {
|
|
2138
|
-
baseCss,
|
|
2139
|
-
css,
|
|
2140
|
-
changed: false
|
|
2141
|
-
};
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
function isCssRuleCoveredByDeclarations(rule, baseRuleDeclarationKeys) {
|
|
2145
|
-
const key = getCssRuleStructuralKey(rule);
|
|
2146
|
-
if (!key) return false;
|
|
2147
|
-
const baseDeclarations = baseRuleDeclarationKeys.get(key);
|
|
2148
|
-
if (!baseDeclarations) return false;
|
|
2149
|
-
const declarations = collectCssRuleDeclarationKeys(rule);
|
|
2150
|
-
return declarations.size > 0 && [...declarations].every((declaration) => baseDeclarations.has(declaration));
|
|
2151
|
-
}
|
|
2152
|
-
function mergeCoveredCssRuleDeclarations(baseCss, css) {
|
|
2153
|
-
try {
|
|
2154
|
-
const baseRoot = postcss.default.parse(baseCss);
|
|
2155
|
-
const root = postcss.default.parse(css);
|
|
2156
|
-
const baseRuleRecords = collectCssRuleDeclarationRecords(baseRoot);
|
|
2157
|
-
let changedBase = false;
|
|
2158
|
-
let changedCss = false;
|
|
2159
|
-
root.walkRules((rule) => {
|
|
2160
|
-
const key = getCssRuleStructuralKey(rule);
|
|
2161
|
-
const records = key ? baseRuleRecords.get(key) : void 0;
|
|
2162
|
-
if (!records || records.length === 0) return;
|
|
2163
|
-
const incomingDeclarations = collectCssRuleDeclarations(rule);
|
|
2164
|
-
if (incomingDeclarations.length === 0) return;
|
|
2165
|
-
const baseKeys = new Set(records.flatMap((record) => [...record.keys]));
|
|
2166
|
-
if (incomingDeclarations.filter((decl) => baseKeys.has(normalizeCssDeclarationKey(decl))).length === 0) return;
|
|
2167
|
-
const missingDeclarations = incomingDeclarations.filter((decl) => !baseKeys.has(normalizeCssDeclarationKey(decl)));
|
|
2168
|
-
if (missingDeclarations.length === 0) {
|
|
2169
|
-
rule.remove();
|
|
2170
|
-
changedCss = true;
|
|
2171
|
-
return;
|
|
2172
|
-
}
|
|
2173
|
-
const baseProps = new Set(records.flatMap((record) => [...record.props]));
|
|
2174
|
-
if (missingDeclarations.filter((decl) => baseProps.has(decl.prop.trim())).length > 0) return;
|
|
2175
|
-
const targetRecord = records[0];
|
|
2176
|
-
if (!targetRecord) return;
|
|
2177
|
-
for (const decl of missingDeclarations) {
|
|
2178
|
-
targetRecord.rule.append(decl.clone());
|
|
2179
|
-
targetRecord.keys.add(normalizeCssDeclarationKey(decl));
|
|
2180
|
-
targetRecord.props.add(decl.prop.trim());
|
|
2181
|
-
}
|
|
2182
|
-
rule.remove();
|
|
2183
|
-
changedBase = true;
|
|
2184
|
-
changedCss = true;
|
|
2185
|
-
});
|
|
2186
|
-
if (!changedBase && !changedCss) return {
|
|
2187
|
-
baseCss,
|
|
2188
|
-
css,
|
|
2189
|
-
changed: false
|
|
2190
|
-
};
|
|
2191
|
-
removeEmptyAtRules(root);
|
|
2192
|
-
return {
|
|
2193
|
-
baseCss: changedBase ? baseRoot.toString() : baseCss,
|
|
2194
|
-
css: changedCss ? root.toString().trim() : css,
|
|
2195
|
-
changed: true
|
|
2196
|
-
};
|
|
2197
|
-
} catch {
|
|
2198
|
-
return {
|
|
2199
|
-
baseCss,
|
|
2200
|
-
css,
|
|
2201
|
-
changed: false
|
|
2202
|
-
};
|
|
2203
|
-
}
|
|
2204
|
-
}
|
|
2205
|
-
function removeEmptyAtRules(root) {
|
|
2206
|
-
root.walkAtRules((atRule) => {
|
|
2207
|
-
if (atRule.nodes && atRule.nodes.length === 0) atRule.remove();
|
|
2208
|
-
});
|
|
2209
|
-
}
|
|
2210
|
-
function filterExistingCssRules(baseCss, css) {
|
|
2211
|
-
const baseRuleKeys = collectCssRuleContentKeys(baseCss);
|
|
2212
|
-
if (baseRuleKeys.size === 0) return css;
|
|
2213
|
-
try {
|
|
2214
|
-
const root = postcss.default.parse(css);
|
|
2215
|
-
const baseRuleDeclarationKeys = collectCssRuleDeclarationKeyMap(baseCss);
|
|
2216
|
-
let changed = false;
|
|
2217
|
-
root.walkRules((rule) => {
|
|
2218
|
-
const key = getCssRuleContentKey(rule);
|
|
2219
|
-
if (key && baseRuleKeys.has(key) || isCssRuleCoveredByDeclarations(rule, baseRuleDeclarationKeys)) {
|
|
2220
|
-
rule.remove();
|
|
2221
|
-
changed = true;
|
|
2222
|
-
}
|
|
2223
|
-
});
|
|
2224
|
-
if (!changed) return css;
|
|
2225
|
-
removeEmptyAtRules(root);
|
|
2226
|
-
return root.toString().trim();
|
|
2227
|
-
} catch {
|
|
2228
|
-
return css;
|
|
2229
|
-
}
|
|
2230
|
-
}
|
|
2231
|
-
function containsCssAfterMinify(baseCss, css) {
|
|
2232
|
-
if (baseCss.includes(css)) return true;
|
|
2233
|
-
const normalizedBaseCss = normalizeCssForContainment(baseCss);
|
|
2234
|
-
const normalizedCss = normalizeCssForContainment(css);
|
|
2235
|
-
if (normalizedCss.length > 0 && normalizedBaseCss.includes(normalizedCss)) return true;
|
|
2236
|
-
const normalizedNodes = collectNormalizedCssNodes(css);
|
|
2237
|
-
if (normalizedNodes.length > 0 && normalizedNodes.every((node) => normalizedBaseCss.includes(node))) return true;
|
|
2238
|
-
const baseRuleKeys = collectCssRuleContentKeys(baseCss);
|
|
2239
|
-
const ruleKeys = collectCssRuleContentKeys(css);
|
|
2240
|
-
return ruleKeys.size > 0 && [...ruleKeys].every((key) => baseRuleKeys.has(key));
|
|
2241
|
-
}
|
|
2242
|
-
//#endregion
|
|
2243
1881
|
//#region src/bundlers/vite/processed-css-assets.ts
|
|
2244
1882
|
const CSS_OUTPUT_FILE_RE = /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i;
|
|
2245
1883
|
function isCssOutputFile(file) {
|
|
@@ -2263,7 +1901,7 @@ function appendCss(baseCss, css) {
|
|
|
2263
1901
|
function removeTailwindSourceMediaWrappers(css) {
|
|
2264
1902
|
if (!css.includes("@media source(")) return css;
|
|
2265
1903
|
try {
|
|
2266
|
-
const root = postcss.
|
|
1904
|
+
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2267
1905
|
let changed = false;
|
|
2268
1906
|
root.walkAtRules("media", (atRule) => {
|
|
2269
1907
|
if (!atRule.params.startsWith("source(")) return;
|
|
@@ -2301,7 +1939,7 @@ function resolveImportedStyleFile(targetFile, request) {
|
|
|
2301
1939
|
function collectImportedStyleFiles(css, targetFile) {
|
|
2302
1940
|
const imports = /* @__PURE__ */ new Set();
|
|
2303
1941
|
try {
|
|
2304
|
-
postcss.
|
|
1942
|
+
_weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules("import", (atRule) => {
|
|
2305
1943
|
const importedFile = resolveImportedStyleFile(targetFile, require_v3_engine.parseImportRequest(atRule.params));
|
|
2306
1944
|
if (importedFile) imports.add(importedFile);
|
|
2307
1945
|
});
|
|
@@ -2340,7 +1978,7 @@ function removeCssCoveredByImportedViteResults(css, importedCssSources) {
|
|
|
2340
1978
|
if (importedCssSources.length === 0) return css;
|
|
2341
1979
|
const importedCss = importedCssSources.map((source) => require_bundle_state.stripBundlerGeneratedCssMarkers(source).trim()).filter(Boolean).join("\n");
|
|
2342
1980
|
if (importedCss.length === 0) return css;
|
|
2343
|
-
return filterExistingCssRules(importedCss, css);
|
|
1981
|
+
return (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(importedCss, css);
|
|
2344
1982
|
}
|
|
2345
1983
|
function collectImportedBundleCssSources(bundle, importedStyleFiles) {
|
|
2346
1984
|
if (importedStyleFiles.size === 0) return [];
|
|
@@ -2422,27 +2060,27 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
2422
2060
|
css = require_hmr_timing.extractMarkedUserLayerComponentsCss(css).rest.trim();
|
|
2423
2061
|
if (css.length === 0) continue;
|
|
2424
2062
|
}
|
|
2425
|
-
if (containsCssAfterMinify(nextCss, css)) continue;
|
|
2426
|
-
const mergedPreflightDeclarations = mergeMiniProgramPreflightRuleDeclarations(nextCss, css);
|
|
2063
|
+
if ((0, _weapp_tailwindcss_postcss.containsCssAfterMinify)(nextCss, css)) continue;
|
|
2064
|
+
const mergedPreflightDeclarations = (0, _weapp_tailwindcss_postcss.mergeMiniProgramPreflightRuleDeclarations)(nextCss, css);
|
|
2427
2065
|
if (mergedPreflightDeclarations.changed) {
|
|
2428
2066
|
nextCss = mergedPreflightDeclarations.baseCss;
|
|
2429
2067
|
css = mergedPreflightDeclarations.css.trim();
|
|
2430
2068
|
if (css.length === 0) continue;
|
|
2431
2069
|
}
|
|
2432
|
-
const mergedThemeScopeDeclarations = mergeMiniProgramThemeScopeRuleDeclarations(nextCss, css);
|
|
2070
|
+
const mergedThemeScopeDeclarations = (0, _weapp_tailwindcss_postcss.mergeMiniProgramThemeScopeRuleDeclarations)(nextCss, css);
|
|
2433
2071
|
if (mergedThemeScopeDeclarations.changed) {
|
|
2434
2072
|
nextCss = mergedThemeScopeDeclarations.baseCss;
|
|
2435
2073
|
css = mergedThemeScopeDeclarations.css.trim();
|
|
2436
2074
|
if (css.length === 0) continue;
|
|
2437
2075
|
}
|
|
2438
|
-
const mergedRuleDeclarations = mergeCoveredCssRuleDeclarations(nextCss, css);
|
|
2076
|
+
const mergedRuleDeclarations = (0, _weapp_tailwindcss_postcss.mergeCoveredCssRuleDeclarations)(nextCss, css);
|
|
2439
2077
|
if (mergedRuleDeclarations.changed) {
|
|
2440
2078
|
nextCss = mergedRuleDeclarations.baseCss;
|
|
2441
2079
|
css = mergedRuleDeclarations.css.trim();
|
|
2442
2080
|
if (css.length === 0) continue;
|
|
2443
2081
|
}
|
|
2444
|
-
const missingCss = filterExistingCssRules(nextCss, css);
|
|
2445
|
-
if (missingCss.length === 0 || containsCssAfterMinify(nextCss, missingCss)) continue;
|
|
2082
|
+
const missingCss = (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(nextCss, css);
|
|
2083
|
+
if (missingCss.length === 0 || (0, _weapp_tailwindcss_postcss.containsCssAfterMinify)(nextCss, missingCss)) continue;
|
|
2446
2084
|
nextCss = appendCss(nextCss, missingCss);
|
|
2447
2085
|
}
|
|
2448
2086
|
if (nextCss === originalSource) continue;
|
|
@@ -3070,12 +2708,12 @@ function createGenerateBundleHook(context) {
|
|
|
3070
2708
|
debug("css replay generated result: %s bytes=%d", outputFile, css.length);
|
|
3071
2709
|
}
|
|
3072
2710
|
const replayAsset = createReplayCssAsset(outputFile, css);
|
|
2711
|
+
bundle[outputFile] = replayAsset;
|
|
3073
2712
|
if (typeof this.emitFile === "function") this.emitFile({
|
|
3074
2713
|
type: "asset",
|
|
3075
2714
|
fileName: outputFile,
|
|
3076
2715
|
source: css
|
|
3077
2716
|
});
|
|
3078
|
-
else bundle[outputFile] = replayAsset;
|
|
3079
2717
|
markCssAssetProcessed?.(replayAsset, outputFile);
|
|
3080
2718
|
metrics.css.elapsed += measureElapsed(start);
|
|
3081
2719
|
metrics.css.transformed++;
|
|
@@ -3356,30 +2994,6 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
3356
2994
|
}
|
|
3357
2995
|
//#endregion
|
|
3358
2996
|
//#region src/bundlers/vite/official-tailwind-plugins.ts
|
|
3359
|
-
const tailwindPostcssPluginNames = new Set(["tailwindcss", "@tailwindcss/postcss"]);
|
|
3360
|
-
function getPostcssPluginName(plugin) {
|
|
3361
|
-
if (!plugin) return;
|
|
3362
|
-
if (typeof plugin === "function" && "postcss" in plugin) try {
|
|
3363
|
-
return getPostcssPluginName(plugin());
|
|
3364
|
-
} catch {
|
|
3365
|
-
return;
|
|
3366
|
-
}
|
|
3367
|
-
if (typeof plugin !== "object" || !("postcssPlugin" in plugin)) return;
|
|
3368
|
-
const { postcssPlugin } = plugin;
|
|
3369
|
-
return typeof postcssPlugin === "string" ? postcssPlugin : void 0;
|
|
3370
|
-
}
|
|
3371
|
-
function isTailwindPostcssPlugin(plugin) {
|
|
3372
|
-
const name = getPostcssPluginName(plugin);
|
|
3373
|
-
return typeof name === "string" && tailwindPostcssPluginNames.has(name);
|
|
3374
|
-
}
|
|
3375
|
-
function removeTailwindPostcssPlugins(plugins) {
|
|
3376
|
-
let removed = 0;
|
|
3377
|
-
for (let i = plugins.length - 1; i >= 0; i--) if (isTailwindPostcssPlugin(plugins[i])) {
|
|
3378
|
-
plugins.splice(i, 1);
|
|
3379
|
-
removed++;
|
|
3380
|
-
}
|
|
3381
|
-
return removed;
|
|
3382
|
-
}
|
|
3383
2997
|
function isTailwindVitePlugin(plugin) {
|
|
3384
2998
|
if (!plugin || typeof plugin !== "object" || !("name" in plugin)) return false;
|
|
3385
2999
|
const { name } = plugin;
|
|
@@ -3422,24 +3036,6 @@ function disableAndRemoveTailwindVitePlugins(plugins) {
|
|
|
3422
3036
|
return removed;
|
|
3423
3037
|
}
|
|
3424
3038
|
//#endregion
|
|
3425
|
-
//#region src/bundlers/vite/postcss-config.ts
|
|
3426
|
-
async function resolveFilteredPostcssConfig(root) {
|
|
3427
|
-
try {
|
|
3428
|
-
const loaded = await (0, postcss_load_config.default)({}, root);
|
|
3429
|
-
const plugins = Array.isArray(loaded.plugins) ? [...loaded.plugins] : [];
|
|
3430
|
-
const removed = removeTailwindPostcssPlugins(plugins);
|
|
3431
|
-
if (removed === 0) return;
|
|
3432
|
-
return {
|
|
3433
|
-
options: loaded.options,
|
|
3434
|
-
plugins,
|
|
3435
|
-
removed
|
|
3436
|
-
};
|
|
3437
|
-
} catch (error) {
|
|
3438
|
-
if ((error instanceof Error ? error.message : String(error)).includes("No PostCSS Config found")) return;
|
|
3439
|
-
throw error;
|
|
3440
|
-
}
|
|
3441
|
-
}
|
|
3442
|
-
//#endregion
|
|
3443
3039
|
//#region src/bundlers/vite/resolve-app-type.ts
|
|
3444
3040
|
const PACKAGE_JSON_FILE$1 = "package.json";
|
|
3445
3041
|
const MPX_SCRIPT_RE = /\bmpx(?:-cli-service)?\b/u;
|
|
@@ -4620,7 +4216,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
4620
4216
|
replacement: node_path.default.join(weappTailwindcssPackageDir, "generator-placeholder.css")
|
|
4621
4217
|
}] } };
|
|
4622
4218
|
if (config.css?.postcss !== void 0) return baseConfig;
|
|
4623
|
-
return resolveFilteredPostcssConfig(root).then((postcssConfig) => {
|
|
4219
|
+
return (0, _weapp_tailwindcss_postcss.resolveFilteredPostcssConfig)(root).then((postcssConfig) => {
|
|
4624
4220
|
if (!postcssConfig) return baseConfig;
|
|
4625
4221
|
debug("inline filtered postcss config without official tailwind plugins in generator mode: %d", postcssConfig.removed);
|
|
4626
4222
|
return {
|
|
@@ -4664,10 +4260,10 @@ function WeappTailwindcss(options = {}) {
|
|
|
4664
4260
|
if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
|
|
4665
4261
|
const postcssPlugins = config.css.postcss.plugins;
|
|
4666
4262
|
if (shouldOwnTailwindGeneration) {
|
|
4667
|
-
const removed = removeTailwindPostcssPlugins(postcssPlugins);
|
|
4263
|
+
const removed = (0, _weapp_tailwindcss_postcss.removeTailwindPostcssPlugins)(postcssPlugins);
|
|
4668
4264
|
if (removed > 0) debug("remove official tailwind postcss plugins in generator mode: %d", removed);
|
|
4669
4265
|
}
|
|
4670
|
-
const idx = postcssPlugins.findIndex((x) => getPostcssPluginName(x) === "postcss-html-transform");
|
|
4266
|
+
const idx = postcssPlugins.findIndex((x) => (0, _weapp_tailwindcss_postcss.getPostcssPluginName)(x) === "postcss-html-transform");
|
|
4671
4267
|
if (idx > -1) {
|
|
4672
4268
|
postcssPlugins.splice(idx, 1, (0, _weapp_tailwindcss_postcss_html_transform.default)());
|
|
4673
4269
|
debug("remove postcss-html-transform plugin from vite config");
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-Bh-BNp5g.js");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-BM_iIFmS.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
let node_fs = require("node:fs");
|
|
24
|
+
let node_path = require("node:path");
|
|
25
|
+
node_path = __toESM(node_path);
|
|
26
|
+
//#region src/bundlers/webpack/loaders/runtime-registry.ts
|
|
27
|
+
const runtimeRegistryHolder = globalThis;
|
|
28
|
+
const runtimeRegistry = runtimeRegistryHolder.__WEAPP_TW_WEBPACK_LOADER_RUNTIME_REGISTRY__ ?? (runtimeRegistryHolder.__WEAPP_TW_WEBPACK_LOADER_RUNTIME_REGISTRY__ = /* @__PURE__ */ new Map());
|
|
29
|
+
function getWebpackLoaderRuntime(key) {
|
|
30
|
+
return key ? runtimeRegistry.get(key) : void 0;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/bundlers/webpack/loaders/watch-dependencies.ts
|
|
34
|
+
function normalizeWebpackWatchPath(file) {
|
|
35
|
+
return node_path.default.resolve(file);
|
|
36
|
+
}
|
|
37
|
+
function registerWebpackWatchFile(loaderContext, file) {
|
|
38
|
+
const resolved = normalizeWebpackWatchPath(file);
|
|
39
|
+
try {
|
|
40
|
+
if ((0, node_fs.statSync)(resolved).isDirectory()) {
|
|
41
|
+
loaderContext.addContextDependency?.(resolved);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
loaderContext.addDependency?.(resolved);
|
|
45
|
+
} catch {
|
|
46
|
+
if (loaderContext.addMissingDependency) {
|
|
47
|
+
loaderContext.addMissingDependency(resolved);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
loaderContext.addDependency?.(resolved);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function registerWebpackWatchContext(loaderContext, context) {
|
|
54
|
+
loaderContext.addContextDependency?.(normalizeWebpackWatchPath(context));
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
Object.defineProperty(exports, "__toESM", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function() {
|
|
60
|
+
return __toESM;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "getWebpackLoaderRuntime", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function() {
|
|
66
|
+
return getWebpackLoaderRuntime;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "registerWebpackWatchContext", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function() {
|
|
72
|
+
return registerWebpackWatchContext;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(exports, "registerWebpackWatchFile", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function() {
|
|
78
|
+
return registerWebpackWatchFile;
|
|
79
|
+
}
|
|
80
|
+
});
|