extension-develop 3.0.0-next.42 → 3.0.0-next.44
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/module.js +55 -26
- package/package.json +1 -1
package/dist/module.js
CHANGED
|
@@ -5100,7 +5100,7 @@ var __webpack_modules__ = {
|
|
|
5100
5100
|
},
|
|
5101
5101
|
"./package.json": function(module) {
|
|
5102
5102
|
"use strict";
|
|
5103
|
-
module.exports = JSON.parse('{"i8":"3.0.0-next.
|
|
5103
|
+
module.exports = JSON.parse('{"i8":"3.0.0-next.44","HO":{"@rspack/core":"^1.6.3","@rspack/dev-server":"^1.1.4","@swc/core":"^1.13.2","@swc/helpers":"^0.5.15","adm-zip":"^0.5.16","browser-extension-manifest-fields":"^2.2.1","case-sensitive-paths-webpack-plugin":"^2.4.0","chokidar":"^4.0.1","chrome-location2":"3.2.1","chromium-location":"1.2.3","content-security-policy-parser":"^0.6.0","cross-spawn":"^7.0.6","dotenv":"^16.4.7","edge-location":"^2.1.1","firefox-location2":"2.1.1","go-git-it":"^5.0.0","ignore":"^6.0.2","loader-utils":"^3.3.1","magic-string":"^0.30.10","package-manager-detector":"^0.2.7","parse5":"^7.2.1","parse5-utilities":"^1.0.0","pintor":"0.3.0","schema-utils":"^4.2.0","tiny-glob":"^0.2.9","unique-names-generator":"^4.7.1","webextension-polyfill":"^0.12.0","webpack-merge":"^6.0.1","webpack-target-webextension":"^2.1.3","ws":"^8.18.0"}}');
|
|
5104
5104
|
}
|
|
5105
5105
|
};
|
|
5106
5106
|
var __webpack_module_cache__ = {};
|
|
@@ -6476,25 +6476,23 @@ var __webpack_exports__ = {};
|
|
|
6476
6476
|
}
|
|
6477
6477
|
async function maybeUsePostCss(projectPath, opts) {
|
|
6478
6478
|
const userPostCssConfig = findPostCssConfig(projectPath);
|
|
6479
|
-
function
|
|
6479
|
+
function getPackageJsonConfig(p) {
|
|
6480
6480
|
try {
|
|
6481
6481
|
const raw = external_fs_.readFileSync(external_path_.join(p, 'package.json'), 'utf8');
|
|
6482
6482
|
const pkg = JSON.parse(raw || '{}');
|
|
6483
|
-
return
|
|
6483
|
+
return {
|
|
6484
|
+
hasPostCss: !!(null == pkg ? void 0 : pkg.postcss),
|
|
6485
|
+
config: null == pkg ? void 0 : pkg.postcss
|
|
6486
|
+
};
|
|
6484
6487
|
} catch {
|
|
6485
|
-
return
|
|
6488
|
+
return {
|
|
6489
|
+
hasPostCss: false
|
|
6490
|
+
};
|
|
6486
6491
|
}
|
|
6487
6492
|
}
|
|
6488
|
-
const pkgHasPostCss =
|
|
6493
|
+
const { hasPostCss: pkgHasPostCss, config: pkgPostCssConfig } = getPackageJsonConfig(projectPath);
|
|
6489
6494
|
const tailwindPresent = tailwind_isUsingTailwind(projectPath);
|
|
6490
6495
|
if (!userPostCssConfig && !pkgHasPostCss && !tailwindPresent) return {};
|
|
6491
|
-
if (tailwindPresent) try {
|
|
6492
|
-
const req = (0, external_module_namespaceObject.createRequire)(external_path_.join(projectPath, 'package.json'));
|
|
6493
|
-
req.resolve('@tailwindcss/postcss');
|
|
6494
|
-
} catch {
|
|
6495
|
-
console.error(`PostCSS plugin "@tailwindcss/postcss" not found in ${projectPath}.\nInstall it in that package (e.g. "pnpm add -D @tailwindcss/postcss") and retry.`);
|
|
6496
|
-
process.exit(1);
|
|
6497
|
-
}
|
|
6498
6496
|
try {
|
|
6499
6497
|
require.resolve('postcss-loader');
|
|
6500
6498
|
} catch (e) {
|
|
@@ -6521,23 +6519,50 @@ var __webpack_exports__ = {};
|
|
|
6521
6519
|
}
|
|
6522
6520
|
}
|
|
6523
6521
|
let plugins;
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6522
|
+
const reqFromProject = (0, external_module_namespaceObject.createRequire)(external_path_.join(projectPath, 'package.json'));
|
|
6523
|
+
async function loadConfigFromFile(configPath) {
|
|
6524
|
+
try {
|
|
6525
|
+
if (configPath.endsWith('.mjs') || configPath.endsWith('.mts')) {
|
|
6526
|
+
const url = (0, external_url_.pathToFileURL)(configPath).href;
|
|
6527
|
+
const mod = await import(url);
|
|
6528
|
+
return (null == mod ? void 0 : mod.default) ?? mod;
|
|
6529
|
+
}
|
|
6530
|
+
const req = (0, external_module_namespaceObject.createRequire)(configPath);
|
|
6531
|
+
return req(configPath);
|
|
6532
|
+
} catch {
|
|
6533
|
+
return;
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
let rawConfig;
|
|
6537
|
+
if (userPostCssConfig) rawConfig = await loadConfigFromFile(userPostCssConfig);
|
|
6538
|
+
else if (pkgHasPostCss && pkgPostCssConfig) rawConfig = pkgPostCssConfig;
|
|
6539
|
+
const configPlugins = null == rawConfig ? void 0 : rawConfig.plugins;
|
|
6540
|
+
if (Array.isArray(configPlugins)) plugins = configPlugins.map((entry)=>{
|
|
6541
|
+
try {
|
|
6542
|
+
if ('function' == typeof entry) return entry;
|
|
6543
|
+
if (Array.isArray(entry)) {
|
|
6544
|
+
const [plugin, options] = entry;
|
|
6545
|
+
if ('function' == typeof plugin) return plugin(options);
|
|
6546
|
+
if ('string' == typeof plugin) {
|
|
6547
|
+
const mod = reqFromProject(plugin);
|
|
6534
6548
|
return 'function' == typeof mod ? mod(options) : mod;
|
|
6535
|
-
} catch {
|
|
6536
|
-
return;
|
|
6537
6549
|
}
|
|
6538
|
-
}
|
|
6550
|
+
}
|
|
6551
|
+
return;
|
|
6552
|
+
} catch {
|
|
6553
|
+
return;
|
|
6539
6554
|
}
|
|
6540
|
-
}
|
|
6555
|
+
}).filter(Boolean);
|
|
6556
|
+
else if (configPlugins && 'object' == typeof configPlugins) plugins = Object.entries(configPlugins).map(([plugin, options])=>{
|
|
6557
|
+
if (false === options) return;
|
|
6558
|
+
try {
|
|
6559
|
+
const mod = 'string' == typeof plugin ? reqFromProject(plugin) : plugin;
|
|
6560
|
+
if ('function' == typeof mod) return true === options || void 0 === options ? mod() : mod(options);
|
|
6561
|
+
return mod;
|
|
6562
|
+
} catch {
|
|
6563
|
+
return;
|
|
6564
|
+
}
|
|
6565
|
+
}).filter(Boolean);
|
|
6541
6566
|
const postcssOptions = {
|
|
6542
6567
|
ident: 'postcss',
|
|
6543
6568
|
cwd: projectPath
|
|
@@ -6546,6 +6571,10 @@ var __webpack_exports__ = {};
|
|
|
6546
6571
|
postcssOptions.config = false;
|
|
6547
6572
|
postcssOptions.plugins = plugins;
|
|
6548
6573
|
} else postcssOptions.config = projectPath;
|
|
6574
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
6575
|
+
console.log('[extension.js:postcss] projectPath=%s userPostCssConfig=%s pkgHasPostCss=%s tailwindPresent=%s', projectPath, userPostCssConfig || 'none', pkgHasPostCss, tailwindPresent);
|
|
6576
|
+
console.log('[extension.js:postcss] resolvedPlugins=%d config=%s cwd=%s', Array.isArray(plugins) ? plugins.length : 0, String(postcssOptions.config), String(postcssOptions.cwd));
|
|
6577
|
+
} catch {}
|
|
6549
6578
|
return {
|
|
6550
6579
|
test: /\.css$/,
|
|
6551
6580
|
type: 'css',
|