extension-develop 3.1.0-next.6 → 3.1.0-next.7
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/{329.js → 547.js} +41 -707
- package/dist/module.js +128099 -79
- package/package.json +1 -1
- package/dist/814.js +0 -127125
- /package/dist/{814.js.LICENSE.txt → module.js.LICENSE.txt} +0 -0
package/dist/{329.js → 547.js}
RENAMED
|
@@ -3,7 +3,7 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
|
3
3
|
return "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
4
4
|
}();
|
|
5
5
|
exports.ids = [
|
|
6
|
-
"
|
|
6
|
+
"547"
|
|
7
7
|
];
|
|
8
8
|
exports.modules = {
|
|
9
9
|
"./webpack/webpack-config.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -461,196 +461,10 @@ exports.modules = {
|
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
463
|
plugin_compilation_define_property(CompilationPlugin, "name", 'plugin-compilation');
|
|
464
|
-
|
|
465
|
-
const list = integrations.length > 0 ? integrations.map((n)=>external_pintor_default().yellow(n)).join(', ') : external_pintor_default().gray('none');
|
|
466
|
-
return `${external_pintor_default().gray('►►►')} CSS: Integrations enabled (${external_pintor_default().gray(String(integrations.length))}) ${list}`;
|
|
467
|
-
}
|
|
468
|
-
function cssConfigsDetected(postcssConfig, stylelintConfig, tailwindConfig, browserslistSource) {
|
|
469
|
-
const fmt = (v)=>v ? external_pintor_default().underline(v) : external_pintor_default().gray('none');
|
|
470
|
-
return `${external_pintor_default().gray('►►►')} CSS: Configs\n${external_pintor_default().gray('POSTCSS')} ${fmt(postcssConfig)}\n${external_pintor_default().gray('STYLELINT')} ${fmt(stylelintConfig)}\n${external_pintor_default().gray('TAILWIND')} ${fmt(tailwindConfig)}\n${external_pintor_default().gray('BROWSERSLIST')} ${fmt(browserslistSource)}`;
|
|
471
|
-
}
|
|
472
|
-
function isUsingIntegration(name) {
|
|
473
|
-
return `${external_pintor_default().gray('►►►')} Using ${external_pintor_default().brightBlue(name)}...`;
|
|
474
|
-
}
|
|
475
|
-
function youAreAllSet(name) {
|
|
476
|
-
return `${external_pintor_default().green('►►►')} ${name} installation completed. Run again to proceed.`;
|
|
477
|
-
}
|
|
478
|
-
function missingSassDependency() {
|
|
479
|
-
const prefix = external_pintor_default().red('►►►');
|
|
480
|
-
return [
|
|
481
|
-
`${prefix} SASS support requires the ${external_pintor_default().brightBlue('"sass"')} package to be installed in your project.`,
|
|
482
|
-
'',
|
|
483
|
-
"Add it to your devDependencies, for example:",
|
|
484
|
-
` ${external_pintor_default().gray('npm install --save-dev sass')}`,
|
|
485
|
-
` ${external_pintor_default().gray('pnpm add -D sass')}`,
|
|
486
|
-
'',
|
|
487
|
-
'Sample package.json:',
|
|
488
|
-
' {',
|
|
489
|
-
' "devDependencies": {',
|
|
490
|
-
` "sass": ${external_pintor_default().yellow('"<version>"')}`,
|
|
491
|
-
' }',
|
|
492
|
-
' }'
|
|
493
|
-
].join('\n');
|
|
494
|
-
}
|
|
464
|
+
var css_lib_messages = __webpack_require__("./webpack/plugin-css/css-lib/messages.ts");
|
|
495
465
|
var css_lib_integrations = __webpack_require__("./webpack/plugin-css/css-lib/integrations.ts");
|
|
496
|
-
var
|
|
497
|
-
|
|
498
|
-
function isUsingSass(projectPath) {
|
|
499
|
-
if ((0, css_lib_integrations.w)(projectPath, 'sass')) {
|
|
500
|
-
if (!userMessageDelivered) {
|
|
501
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${isUsingIntegration('SASS')}`);
|
|
502
|
-
userMessageDelivered = true;
|
|
503
|
-
}
|
|
504
|
-
return true;
|
|
505
|
-
}
|
|
506
|
-
return false;
|
|
507
|
-
}
|
|
508
|
-
function resolveSassImplementation(projectPath) {
|
|
509
|
-
const bases = [
|
|
510
|
-
projectPath,
|
|
511
|
-
process.cwd()
|
|
512
|
-
];
|
|
513
|
-
for (const base of bases)try {
|
|
514
|
-
const req = (0, external_module_.createRequire)(external_path_.join(base, 'package.json'));
|
|
515
|
-
let mod = req('sass');
|
|
516
|
-
if (mod && 'object' == typeof mod && 'default' in mod) mod = mod.default;
|
|
517
|
-
return mod;
|
|
518
|
-
} catch {}
|
|
519
|
-
try {
|
|
520
|
-
let mod = __webpack_require__("../../node_modules/.pnpm/sass@1.97.2/node_modules/sass/sass.node.js");
|
|
521
|
-
if (mod && 'object' == typeof mod && 'default' in mod) mod = mod.default;
|
|
522
|
-
return mod;
|
|
523
|
-
} catch {
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
function createSassLoaderOptions(projectPath, mode) {
|
|
528
|
-
const implementation = resolveSassImplementation(projectPath);
|
|
529
|
-
const usingSass = isUsingSass(projectPath);
|
|
530
|
-
if (usingSass && !implementation) throw new Error(missingSassDependency());
|
|
531
|
-
const base = {
|
|
532
|
-
sourceMap: 'development' === mode,
|
|
533
|
-
sassOptions: {
|
|
534
|
-
outputStyle: 'expanded'
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
if (implementation) base.implementation = implementation;
|
|
538
|
-
return base;
|
|
539
|
-
}
|
|
540
|
-
async function maybeUseSass(projectPath) {
|
|
541
|
-
if (!isUsingSass(projectPath)) return [];
|
|
542
|
-
try {
|
|
543
|
-
require.resolve('sass-loader');
|
|
544
|
-
} catch (e) {
|
|
545
|
-
const postCssDependencies = [
|
|
546
|
-
'postcss-loader',
|
|
547
|
-
'postcss-scss',
|
|
548
|
-
'postcss-preset-env'
|
|
549
|
-
];
|
|
550
|
-
await (0, css_lib_integrations.t)('PostCSS', postCssDependencies);
|
|
551
|
-
const sassDependencies = [
|
|
552
|
-
'sass-loader'
|
|
553
|
-
];
|
|
554
|
-
await (0, css_lib_integrations.t)('SASS', sassDependencies);
|
|
555
|
-
console.log(youAreAllSet('SASS'));
|
|
556
|
-
process.exit(0);
|
|
557
|
-
}
|
|
558
|
-
return [
|
|
559
|
-
{
|
|
560
|
-
test: /\.(sass|scss)$/,
|
|
561
|
-
exclude: /\.module\.(sass|scss)$/,
|
|
562
|
-
use: [
|
|
563
|
-
{
|
|
564
|
-
loader: require.resolve('sass-loader'),
|
|
565
|
-
options: createSassLoaderOptions(projectPath, 'development')
|
|
566
|
-
}
|
|
567
|
-
]
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
test: /\.module\.(sass|scss)$/,
|
|
571
|
-
use: [
|
|
572
|
-
{
|
|
573
|
-
loader: require.resolve('sass-loader'),
|
|
574
|
-
options: createSassLoaderOptions(projectPath, 'development')
|
|
575
|
-
}
|
|
576
|
-
]
|
|
577
|
-
}
|
|
578
|
-
];
|
|
579
|
-
}
|
|
580
|
-
function is_content_script_parseJsonSafe(text) {
|
|
581
|
-
const s = text && 0xfeff === text.charCodeAt(0) ? text.slice(1) : text;
|
|
582
|
-
return JSON.parse(s || '{}');
|
|
583
|
-
}
|
|
584
|
-
function isContentScriptEntry(absolutePath, manifestPath) {
|
|
585
|
-
if (!absolutePath || !manifestPath) return false;
|
|
586
|
-
if (!external_fs_.existsSync(manifestPath)) return false;
|
|
587
|
-
const manifest = is_content_script_parseJsonSafe(external_fs_.readFileSync(manifestPath, 'utf8'));
|
|
588
|
-
for (const content of manifest.content_scripts || [])if (content.js?.length) for (const js of content.js){
|
|
589
|
-
const contentPath = external_path_.resolve(external_path_.dirname(manifestPath), js);
|
|
590
|
-
if (contentPath === absolutePath) return true;
|
|
591
|
-
}
|
|
592
|
-
return false;
|
|
593
|
-
}
|
|
594
|
-
let less_userMessageDelivered = false;
|
|
595
|
-
function isUsingLess(projectPath) {
|
|
596
|
-
if ((0, css_lib_integrations.w)(projectPath, 'less')) {
|
|
597
|
-
if (!less_userMessageDelivered) {
|
|
598
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${isUsingIntegration('LESS')}`);
|
|
599
|
-
less_userMessageDelivered = true;
|
|
600
|
-
}
|
|
601
|
-
return true;
|
|
602
|
-
}
|
|
603
|
-
return false;
|
|
604
|
-
}
|
|
605
|
-
async function maybeUseLess(projectPath, manifestPath) {
|
|
606
|
-
const resolvedManifestPath = manifestPath || external_path_.join(projectPath, 'manifest.json');
|
|
607
|
-
if (!isUsingLess(projectPath)) return [];
|
|
608
|
-
try {
|
|
609
|
-
require.resolve('less-loader');
|
|
610
|
-
} catch (e) {
|
|
611
|
-
const lessDependencies = [
|
|
612
|
-
'less',
|
|
613
|
-
'less-loader'
|
|
614
|
-
];
|
|
615
|
-
await (0, css_lib_integrations.t)('LESS', lessDependencies);
|
|
616
|
-
console.log(youAreAllSet('LESS'));
|
|
617
|
-
process.exit(0);
|
|
618
|
-
}
|
|
619
|
-
return [
|
|
620
|
-
{
|
|
621
|
-
test: /\.less$/,
|
|
622
|
-
exclude: /\.module\.less$/,
|
|
623
|
-
use: [
|
|
624
|
-
{
|
|
625
|
-
loader: require.resolve('less-loader'),
|
|
626
|
-
options: {
|
|
627
|
-
sourceMap: true
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
]
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
test: /\.module\.less$/,
|
|
634
|
-
use: [
|
|
635
|
-
{
|
|
636
|
-
loader: require.resolve('less-loader'),
|
|
637
|
-
options: {
|
|
638
|
-
sourceMap: true
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
]
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
test: /\.less$/,
|
|
645
|
-
exclude: /\.module\.less$/,
|
|
646
|
-
type: 'asset/resource',
|
|
647
|
-
generator: {
|
|
648
|
-
filename: "content_scripts/[name].[contenthash:8].css"
|
|
649
|
-
},
|
|
650
|
-
issuer: (issuer)=>isContentScriptEntry(issuer, resolvedManifestPath)
|
|
651
|
-
}
|
|
652
|
-
];
|
|
653
|
-
}
|
|
466
|
+
var sass = __webpack_require__("./webpack/plugin-css/css-tools/sass.ts");
|
|
467
|
+
var less = __webpack_require__("./webpack/plugin-css/css-tools/less.ts");
|
|
654
468
|
function getStylelintConfigFile(projectPath) {
|
|
655
469
|
const stylelintConfigJs = external_path_.join(projectPath, 'stylelint.config.js');
|
|
656
470
|
const stylelintConfigDotJs = external_path_.join(projectPath, '.stylelintrc.js');
|
|
@@ -673,16 +487,16 @@ exports.modules = {
|
|
|
673
487
|
if (external_fs_.existsSync(stylelintConfigYml)) return stylelintConfigYml;
|
|
674
488
|
if (external_fs_.existsSync(stylelintConfigDotYml)) return stylelintConfigDotYml;
|
|
675
489
|
}
|
|
676
|
-
let
|
|
490
|
+
let userMessageDelivered = false;
|
|
677
491
|
function stylelint_isUsingStylelint(projectPath) {
|
|
678
492
|
const packageJsonPath = external_path_.join(projectPath, 'package.json');
|
|
679
493
|
if (!external_fs_.existsSync(packageJsonPath)) return false;
|
|
680
494
|
const configFile = getStylelintConfigFile(projectPath);
|
|
681
495
|
const isUsingStylelint = !!configFile;
|
|
682
496
|
if (isUsingStylelint) {
|
|
683
|
-
if (!
|
|
684
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${
|
|
685
|
-
|
|
497
|
+
if (!userMessageDelivered) {
|
|
498
|
+
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${css_lib_messages.zA('Stylelint')}`);
|
|
499
|
+
userMessageDelivered = true;
|
|
686
500
|
}
|
|
687
501
|
}
|
|
688
502
|
return isUsingStylelint;
|
|
@@ -691,154 +505,12 @@ exports.modules = {
|
|
|
691
505
|
stylelint_isUsingStylelint(projectPath);
|
|
692
506
|
return [];
|
|
693
507
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
const isUsingTailwind = (0, css_lib_integrations.w)(projectPath, 'tailwindcss') || (0, css_lib_integrations.w)(projectPath, '@tailwindcss/postcss');
|
|
697
|
-
if (isUsingTailwind) {
|
|
698
|
-
if (!tailwind_userMessageDelivered) {
|
|
699
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${isUsingIntegration('Tailwind')}`);
|
|
700
|
-
tailwind_userMessageDelivered = true;
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
return isUsingTailwind;
|
|
704
|
-
}
|
|
705
|
-
function getTailwindConfigFile(projectPath) {
|
|
706
|
-
const configFileMjs = external_path_.join(projectPath, 'tailwind.config.mjs');
|
|
707
|
-
const configFileCjs = external_path_.join(projectPath, 'tailwind.config.cjs');
|
|
708
|
-
const configFileJs = external_path_.join(projectPath, 'tailwind.config.js');
|
|
709
|
-
if (external_fs_.existsSync(configFileMjs)) return configFileMjs;
|
|
710
|
-
if (external_fs_.existsSync(configFileCjs)) return configFileCjs;
|
|
711
|
-
if (external_fs_.existsSync(configFileJs)) return configFileJs;
|
|
712
|
-
}
|
|
713
|
-
let postcss_userMessageDelivered = false;
|
|
714
|
-
const postCssConfigFiles = [
|
|
715
|
-
'.postcssrc',
|
|
716
|
-
'.postcssrc.json',
|
|
717
|
-
'.postcssrc.yaml',
|
|
718
|
-
'.postcssrc.yml',
|
|
719
|
-
'postcss.config.mjs',
|
|
720
|
-
'.postcssrc.js',
|
|
721
|
-
'.postcssrc.cjs',
|
|
722
|
-
'postcss.config.js',
|
|
723
|
-
'postcss.config.cjs'
|
|
724
|
-
];
|
|
725
|
-
function findPostCssConfig(projectPath) {
|
|
726
|
-
for (const configFile of postCssConfigFiles){
|
|
727
|
-
const configPath = external_path_.join(projectPath, configFile);
|
|
728
|
-
if (external_fs_.existsSync(configPath)) return configPath;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
function isUsingPostCss(projectPath) {
|
|
732
|
-
if ((0, css_lib_integrations.w)(projectPath, 'postcss')) {
|
|
733
|
-
if (!postcss_userMessageDelivered) {
|
|
734
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${isUsingIntegration('PostCSS')}`);
|
|
735
|
-
postcss_userMessageDelivered = true;
|
|
736
|
-
}
|
|
737
|
-
return true;
|
|
738
|
-
}
|
|
739
|
-
if (findPostCssConfig(projectPath)) {
|
|
740
|
-
if (!postcss_userMessageDelivered) {
|
|
741
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${isUsingIntegration('PostCSS')}`);
|
|
742
|
-
postcss_userMessageDelivered = true;
|
|
743
|
-
}
|
|
744
|
-
return true;
|
|
745
|
-
}
|
|
746
|
-
if (tailwind_isUsingTailwind(projectPath)) {
|
|
747
|
-
if (!postcss_userMessageDelivered) {
|
|
748
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${isUsingIntegration('PostCSS')}`);
|
|
749
|
-
postcss_userMessageDelivered = true;
|
|
750
|
-
}
|
|
751
|
-
return true;
|
|
752
|
-
}
|
|
753
|
-
return false;
|
|
754
|
-
}
|
|
755
|
-
async function maybeUsePostCss(projectPath, opts) {
|
|
756
|
-
const userPostCssConfig = findPostCssConfig(projectPath);
|
|
757
|
-
function getPackageJsonConfig(p) {
|
|
758
|
-
try {
|
|
759
|
-
const raw = external_fs_.readFileSync(external_path_.join(p, 'package.json'), 'utf8');
|
|
760
|
-
const pkg = JSON.parse(raw || '{}');
|
|
761
|
-
return {
|
|
762
|
-
hasPostCss: !!pkg?.postcss,
|
|
763
|
-
config: pkg?.postcss
|
|
764
|
-
};
|
|
765
|
-
} catch {
|
|
766
|
-
return {
|
|
767
|
-
hasPostCss: false
|
|
768
|
-
};
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
const { hasPostCss: pkgHasPostCss, config: pkgPostCssConfig } = getPackageJsonConfig(projectPath);
|
|
772
|
-
const tailwindPresent = tailwind_isUsingTailwind(projectPath);
|
|
773
|
-
if (!userPostCssConfig && !pkgHasPostCss && !tailwindPresent) return {};
|
|
774
|
-
try {
|
|
775
|
-
require.resolve('postcss-loader');
|
|
776
|
-
} catch (e) {
|
|
777
|
-
if (!isUsingSass(projectPath) && !isUsingLess(projectPath)) {
|
|
778
|
-
const postCssDependencies = [
|
|
779
|
-
'postcss',
|
|
780
|
-
'postcss-loader'
|
|
781
|
-
];
|
|
782
|
-
await (0, css_lib_integrations.t)('PostCSS', postCssDependencies);
|
|
783
|
-
}
|
|
784
|
-
console.log(youAreAllSet('PostCSS'));
|
|
785
|
-
process.exit(0);
|
|
786
|
-
}
|
|
787
|
-
let pluginsFromOptions;
|
|
788
|
-
if (tailwindPresent) try {
|
|
789
|
-
const bases = [
|
|
790
|
-
projectPath,
|
|
791
|
-
process.cwd()
|
|
792
|
-
];
|
|
793
|
-
let tailwindMod;
|
|
794
|
-
for (const base of bases)try {
|
|
795
|
-
const req = (0, external_module_.createRequire)(external_path_.join(base, 'package.json'));
|
|
796
|
-
tailwindMod = req('@tailwindcss/postcss');
|
|
797
|
-
break;
|
|
798
|
-
} catch (e) {}
|
|
799
|
-
if (tailwindMod) {
|
|
800
|
-
if (tailwindMod && 'object' == typeof tailwindMod && 'default' in tailwindMod) tailwindMod = tailwindMod.default;
|
|
801
|
-
if ('function' == typeof tailwindMod) {
|
|
802
|
-
const instance = tailwindMod();
|
|
803
|
-
pluginsFromOptions = [
|
|
804
|
-
{
|
|
805
|
-
'@tailwindcss/postcss': false
|
|
806
|
-
},
|
|
807
|
-
instance
|
|
808
|
-
];
|
|
809
|
-
} else if (tailwindMod && 'object' == typeof tailwindMod && 'postcssPlugin' in tailwindMod) pluginsFromOptions = [
|
|
810
|
-
{
|
|
811
|
-
'@tailwindcss/postcss': false
|
|
812
|
-
},
|
|
813
|
-
tailwindMod
|
|
814
|
-
];
|
|
815
|
-
}
|
|
816
|
-
} catch {}
|
|
817
|
-
const postcssOptions = {
|
|
818
|
-
ident: 'postcss',
|
|
819
|
-
cwd: projectPath,
|
|
820
|
-
config: projectPath
|
|
821
|
-
};
|
|
822
|
-
if (pluginsFromOptions) postcssOptions.plugins = pluginsFromOptions;
|
|
823
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) try {
|
|
824
|
-
console.log(`${external_pintor_default().brightMagenta('►►► Author says')} [extension.js:postcss] projectPath=%s userPostCssConfig=%s pkgHasPostCss=%s tailwindPresent=%s`, projectPath, userPostCssConfig || 'none', pkgHasPostCss, tailwindPresent);
|
|
825
|
-
const resolvedPluginsCount = Array.isArray(postcssOptions.plugins) ? postcssOptions.plugins.length : 0;
|
|
826
|
-
console.log(`${external_pintor_default().brightMagenta('►►► Author says')} [extension.js:postcss] resolvedPlugins=%d config=%s cwd=%s`, resolvedPluginsCount, String(postcssOptions.config), String(postcssOptions.cwd));
|
|
827
|
-
} catch {}
|
|
828
|
-
return {
|
|
829
|
-
test: /\.css$/,
|
|
830
|
-
type: 'css',
|
|
831
|
-
loader: require.resolve('postcss-loader'),
|
|
832
|
-
options: {
|
|
833
|
-
postcssOptions,
|
|
834
|
-
sourceMap: 'development' === opts.mode
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
}
|
|
508
|
+
var tailwind = __webpack_require__("./webpack/plugin-css/css-tools/tailwind.ts");
|
|
509
|
+
var postcss = __webpack_require__("./webpack/plugin-css/css-tools/postcss.ts");
|
|
838
510
|
async function commonStyleLoaders(projectPath, opts) {
|
|
839
511
|
const styleLoaders = [];
|
|
840
|
-
if (
|
|
841
|
-
const maybeInstallPostCss = await
|
|
512
|
+
if ((0, postcss.A)(projectPath) || (0, tailwind.F)(projectPath) || (0, sass.fZ)(projectPath) || (0, less.K)(projectPath)) {
|
|
513
|
+
const maybeInstallPostCss = await (0, postcss.t)(projectPath, opts);
|
|
842
514
|
if (maybeInstallPostCss.loader) styleLoaders.push(maybeInstallPostCss);
|
|
843
515
|
}
|
|
844
516
|
if (opts.loader) styleLoaders.push({
|
|
@@ -850,9 +522,10 @@ exports.modules = {
|
|
|
850
522
|
});
|
|
851
523
|
return styleLoaders.filter(Boolean);
|
|
852
524
|
}
|
|
525
|
+
var is_content_script = __webpack_require__("./webpack/plugin-css/css-lib/is-content-script.ts");
|
|
853
526
|
async function cssInContentScriptLoader(projectPath, manifestPath, mode, usage = {}) {
|
|
854
527
|
const { useSass = true, useLess = true } = usage;
|
|
855
|
-
const isContentScript = (issuer)=>
|
|
528
|
+
const isContentScript = (issuer)=>(0, is_content_script.z)(issuer, manifestPath);
|
|
856
529
|
const fileTypes = [
|
|
857
530
|
{
|
|
858
531
|
test: /\.css$/,
|
|
@@ -897,7 +570,7 @@ exports.modules = {
|
|
|
897
570
|
mode: mode
|
|
898
571
|
})
|
|
899
572
|
};
|
|
900
|
-
const loaderOptions = 'sass-loader' === loader ?
|
|
573
|
+
const loaderOptions = 'sass-loader' === loader ? (0, sass.mF)(projectPath, mode) : {
|
|
901
574
|
sourceMap: true
|
|
902
575
|
};
|
|
903
576
|
return {
|
|
@@ -913,7 +586,7 @@ exports.modules = {
|
|
|
913
586
|
}
|
|
914
587
|
async function cssInHtmlLoader(projectPath, mode, manifestPath, usage = {}) {
|
|
915
588
|
const { useSass = true, useLess = true } = usage;
|
|
916
|
-
const isNotContentScript = (issuer)=>!
|
|
589
|
+
const isNotContentScript = (issuer)=>!(0, is_content_script.z)(issuer, manifestPath);
|
|
917
590
|
const fileTypes = [
|
|
918
591
|
{
|
|
919
592
|
test: /\.css$/,
|
|
@@ -960,7 +633,7 @@ exports.modules = {
|
|
|
960
633
|
mode: mode
|
|
961
634
|
})
|
|
962
635
|
};
|
|
963
|
-
const loaderOptions = 'sass-loader' === loader ?
|
|
636
|
+
const loaderOptions = 'sass-loader' === loader ? (0, sass.mF)(projectPath, mode) : {
|
|
964
637
|
sourceMap: true
|
|
965
638
|
};
|
|
966
639
|
return {
|
|
@@ -994,8 +667,8 @@ exports.modules = {
|
|
|
994
667
|
const usingLess = (0, css_lib_integrations.w)(projectPath, 'less');
|
|
995
668
|
const maybeInstallStylelint = await maybeUseStylelint(projectPath);
|
|
996
669
|
plugins.push(...maybeInstallStylelint);
|
|
997
|
-
const maybeInstallSass = await
|
|
998
|
-
const maybeInstallLess = await
|
|
670
|
+
const maybeInstallSass = await (0, sass.IZ)(projectPath);
|
|
671
|
+
const maybeInstallLess = await (0, less.V)(projectPath, manifestPath);
|
|
999
672
|
const loaders = [
|
|
1000
673
|
...await cssInContentScriptLoader(projectPath, manifestPath, mode, {
|
|
1001
674
|
useSass: usingSass,
|
|
@@ -1013,7 +686,7 @@ exports.modules = {
|
|
|
1013
686
|
generator: {
|
|
1014
687
|
filename: "content_scripts/[name].[contenthash:8].css"
|
|
1015
688
|
},
|
|
1016
|
-
issuer: (issuer)=>
|
|
689
|
+
issuer: (issuer)=>(0, is_content_script.z)(issuer, manifestPath)
|
|
1017
690
|
});
|
|
1018
691
|
if (maybeInstallLess.length) loaders.push({
|
|
1019
692
|
test: /\.less$/,
|
|
@@ -1022,7 +695,7 @@ exports.modules = {
|
|
|
1022
695
|
generator: {
|
|
1023
696
|
filename: "content_scripts/[name].[contenthash:8].css"
|
|
1024
697
|
},
|
|
1025
|
-
issuer: (issuer)=>
|
|
698
|
+
issuer: (issuer)=>(0, is_content_script.z)(issuer, manifestPath)
|
|
1026
699
|
});
|
|
1027
700
|
compiler.options.plugins = [
|
|
1028
701
|
...compiler.options.plugins,
|
|
@@ -1035,17 +708,17 @@ exports.modules = {
|
|
|
1035
708
|
if ('true' === process.env.EXTENSION_AUTHOR_MODE) {
|
|
1036
709
|
const integrations = [];
|
|
1037
710
|
const usingTailwind = (0, css_lib_integrations.w)(projectPath, 'tailwindcss');
|
|
1038
|
-
const usingPostcss = (0, css_lib_integrations.w)(projectPath, 'postcss') || void 0 !==
|
|
711
|
+
const usingPostcss = (0, css_lib_integrations.w)(projectPath, 'postcss') || void 0 !== findPostCssConfig(projectPath) || usingSass || usingLess || usingTailwind;
|
|
1039
712
|
if (usingPostcss) integrations.push('PostCSS');
|
|
1040
713
|
if (usingSass) integrations.push('Sass');
|
|
1041
714
|
if (usingLess) integrations.push('Less');
|
|
1042
715
|
if (usingTailwind) integrations.push('Tailwind');
|
|
1043
|
-
console.log(
|
|
1044
|
-
const postcssConfig =
|
|
716
|
+
console.log(css_lib_messages.uo(integrations));
|
|
717
|
+
const postcssConfig = findPostCssConfig(projectPath);
|
|
1045
718
|
const stylelintConfig = getStylelintConfigFile(projectPath);
|
|
1046
|
-
const tailwindConfig =
|
|
719
|
+
const tailwindConfig = (0, tailwind.r)(projectPath);
|
|
1047
720
|
const browserslistSource = findBrowserslistSource(projectPath);
|
|
1048
|
-
console.log(
|
|
721
|
+
console.log(css_lib_messages.fD(postcssConfig, stylelintConfig, tailwindConfig, browserslistSource));
|
|
1049
722
|
}
|
|
1050
723
|
}
|
|
1051
724
|
async apply(compiler) {
|
|
@@ -1059,7 +732,7 @@ exports.modules = {
|
|
|
1059
732
|
}
|
|
1060
733
|
}
|
|
1061
734
|
plugin_css_define_property(CssPlugin, "name", 'plugin-css');
|
|
1062
|
-
const
|
|
735
|
+
const postCssConfigFiles = [
|
|
1063
736
|
'.postcssrc',
|
|
1064
737
|
'.postcssrc.json',
|
|
1065
738
|
'.postcssrc.yaml',
|
|
@@ -1069,8 +742,8 @@ exports.modules = {
|
|
|
1069
742
|
'postcss.config.js',
|
|
1070
743
|
'postcss.config.cjs'
|
|
1071
744
|
];
|
|
1072
|
-
function
|
|
1073
|
-
for (const configFile of
|
|
745
|
+
function findPostCssConfig(projectPath) {
|
|
746
|
+
for (const configFile of postCssConfigFiles){
|
|
1074
747
|
const configPath = external_path_.join(projectPath, configFile);
|
|
1075
748
|
if (external_fs_.existsSync(configPath)) return configPath;
|
|
1076
749
|
}
|
|
@@ -1214,351 +887,12 @@ exports.modules = {
|
|
|
1214
887
|
}
|
|
1215
888
|
}
|
|
1216
889
|
plugin_static_assets_define_property(StaticAssetsPlugin, "name", 'plugin-static-assets');
|
|
1217
|
-
var
|
|
1218
|
-
var
|
|
1219
|
-
|
|
1220
|
-
let cachedPreactRefreshPlugin;
|
|
1221
|
-
function getPreactRefreshPlugin() {
|
|
1222
|
-
if (cachedPreactRefreshPlugin) return cachedPreactRefreshPlugin;
|
|
1223
|
-
try {
|
|
1224
|
-
const mod = __webpack_require__("@rspack/plugin-preact-refresh");
|
|
1225
|
-
const plugin = mod && mod.default || mod;
|
|
1226
|
-
cachedPreactRefreshPlugin = plugin;
|
|
1227
|
-
return cachedPreactRefreshPlugin;
|
|
1228
|
-
} catch {}
|
|
1229
|
-
}
|
|
1230
|
-
function isUsingPreact(projectPath) {
|
|
1231
|
-
if ((0, frameworks_lib_integrations.ws)(projectPath, 'preact')) {
|
|
1232
|
-
if (!preact_userMessageDelivered) {
|
|
1233
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${js_frameworks_lib_messages.zA('Preact')}`);
|
|
1234
|
-
preact_userMessageDelivered = true;
|
|
1235
|
-
}
|
|
1236
|
-
return true;
|
|
1237
|
-
}
|
|
1238
|
-
return false;
|
|
1239
|
-
}
|
|
1240
|
-
async function maybeUsePreact(projectPath) {
|
|
1241
|
-
if (!isUsingPreact(projectPath)) return;
|
|
1242
|
-
try {
|
|
1243
|
-
require.resolve('@rspack/plugin-preact-refresh');
|
|
1244
|
-
} catch (e) {
|
|
1245
|
-
const preactDependencies = [
|
|
1246
|
-
'@prefresh/core',
|
|
1247
|
-
'@prefresh/utils',
|
|
1248
|
-
'@rspack/plugin-preact-refresh',
|
|
1249
|
-
'preact'
|
|
1250
|
-
];
|
|
1251
|
-
await (0, frameworks_lib_integrations.tm)('Preact', preactDependencies);
|
|
1252
|
-
console.log(js_frameworks_lib_messages.Jv('Preact'));
|
|
1253
|
-
process.exit(0);
|
|
1254
|
-
}
|
|
1255
|
-
const PreactRefreshPlugin = getPreactRefreshPlugin();
|
|
1256
|
-
if (!PreactRefreshPlugin) throw new Error('[Preact] @rspack/plugin-preact-refresh is installed but its plugin could not be resolved.');
|
|
1257
|
-
const preactPlugins = [
|
|
1258
|
-
new PreactRefreshPlugin({})
|
|
1259
|
-
];
|
|
1260
|
-
return {
|
|
1261
|
-
plugins: preactPlugins,
|
|
1262
|
-
loaders: void 0,
|
|
1263
|
-
alias: {
|
|
1264
|
-
react: 'preact/compat',
|
|
1265
|
-
'react-dom/test-utils': 'preact/test-utils',
|
|
1266
|
-
'react-dom': 'preact/compat',
|
|
1267
|
-
'react/jsx-runtime': 'preact/jsx-runtime'
|
|
1268
|
-
}
|
|
1269
|
-
};
|
|
1270
|
-
}
|
|
1271
|
-
let react_userMessageDelivered = false;
|
|
1272
|
-
let cachedReactRefreshPlugin;
|
|
1273
|
-
function getReactRefreshPlugin() {
|
|
1274
|
-
if (cachedReactRefreshPlugin) return cachedReactRefreshPlugin;
|
|
1275
|
-
try {
|
|
1276
|
-
const mod = __webpack_require__("@rspack/plugin-react-refresh");
|
|
1277
|
-
const plugin = mod && mod.default || mod;
|
|
1278
|
-
cachedReactRefreshPlugin = plugin;
|
|
1279
|
-
return cachedReactRefreshPlugin;
|
|
1280
|
-
} catch {}
|
|
1281
|
-
}
|
|
1282
|
-
function isUsingReact(projectPath) {
|
|
1283
|
-
if ((0, frameworks_lib_integrations.ws)(projectPath, 'react')) {
|
|
1284
|
-
if (!react_userMessageDelivered) {
|
|
1285
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${js_frameworks_lib_messages.zA('React')}`);
|
|
1286
|
-
react_userMessageDelivered = true;
|
|
1287
|
-
}
|
|
1288
|
-
return true;
|
|
1289
|
-
}
|
|
1290
|
-
return false;
|
|
1291
|
-
}
|
|
1292
|
-
async function maybeUseReact(projectPath) {
|
|
1293
|
-
if (!isUsingReact(projectPath)) return;
|
|
1294
|
-
try {
|
|
1295
|
-
require.resolve('react-refresh');
|
|
1296
|
-
} catch (e) {
|
|
1297
|
-
const reactDependencies = [
|
|
1298
|
-
'react-refresh',
|
|
1299
|
-
'@rspack/plugin-react-refresh'
|
|
1300
|
-
];
|
|
1301
|
-
await (0, frameworks_lib_integrations.tm)('React', reactDependencies);
|
|
1302
|
-
console.log(js_frameworks_lib_messages.Jv('React'));
|
|
1303
|
-
process.exit(0);
|
|
1304
|
-
}
|
|
1305
|
-
const ReactRefreshPlugin = getReactRefreshPlugin();
|
|
1306
|
-
if (!ReactRefreshPlugin) throw new Error('[React] @rspack/plugin-react-refresh is installed but its plugin could not be resolved.');
|
|
1307
|
-
const reactPlugins = [
|
|
1308
|
-
new ReactRefreshPlugin({
|
|
1309
|
-
overlay: false
|
|
1310
|
-
})
|
|
1311
|
-
];
|
|
1312
|
-
const requireFromProject = (0, external_module_.createRequire)(external_path_.join(projectPath, 'package.json'));
|
|
1313
|
-
let reactPath;
|
|
1314
|
-
let reactDomPath;
|
|
1315
|
-
let reactDomClientPath;
|
|
1316
|
-
let jsxRuntimePath;
|
|
1317
|
-
try {
|
|
1318
|
-
reactPath = requireFromProject.resolve('react');
|
|
1319
|
-
} catch {}
|
|
1320
|
-
try {
|
|
1321
|
-
reactDomPath = requireFromProject.resolve('react-dom');
|
|
1322
|
-
} catch {}
|
|
1323
|
-
try {
|
|
1324
|
-
reactDomClientPath = requireFromProject.resolve('react-dom/client');
|
|
1325
|
-
} catch {}
|
|
1326
|
-
try {
|
|
1327
|
-
jsxRuntimePath = requireFromProject.resolve('react/jsx-runtime');
|
|
1328
|
-
} catch {}
|
|
1329
|
-
const alias = {};
|
|
1330
|
-
if (reactPath) alias['react$'] = reactPath;
|
|
1331
|
-
if (reactDomPath) alias['react-dom$'] = reactDomPath;
|
|
1332
|
-
if (reactDomClientPath) alias['react-dom/client'] = reactDomClientPath;
|
|
1333
|
-
if (jsxRuntimePath) alias['react/jsx-runtime'] = jsxRuntimePath;
|
|
1334
|
-
return {
|
|
1335
|
-
plugins: reactPlugins,
|
|
1336
|
-
loaders: void 0,
|
|
1337
|
-
alias
|
|
1338
|
-
};
|
|
1339
|
-
}
|
|
1340
|
-
var external_url_ = __webpack_require__("url");
|
|
1341
|
-
let load_loader_options_userMessageDelivered = false;
|
|
1342
|
-
function isAuthorMode() {
|
|
1343
|
-
const v = String(process.env.EXTENSION_AUTHOR_MODE || '').trim().toLowerCase();
|
|
1344
|
-
return 'true' === v || '1' === v || 'development' === v || 'dev' === v;
|
|
1345
|
-
}
|
|
1346
|
-
function resolveLoaderConfigPath(projectPath, framework) {
|
|
1347
|
-
const candidates = [
|
|
1348
|
-
external_path_.join(projectPath, `${framework}.loader.ts`),
|
|
1349
|
-
external_path_.join(projectPath, `${framework}.loader.mts`),
|
|
1350
|
-
external_path_.join(projectPath, `${framework}.loader.js`),
|
|
1351
|
-
external_path_.join(projectPath, `${framework}.loader.mjs`)
|
|
1352
|
-
];
|
|
1353
|
-
return candidates.find((p)=>external_fs_.existsSync(p)) || null;
|
|
1354
|
-
}
|
|
1355
|
-
async function loadLoaderOptions(projectPath, framework) {
|
|
1356
|
-
const configPath = resolveLoaderConfigPath(projectPath, framework);
|
|
1357
|
-
if (configPath) {
|
|
1358
|
-
if (!load_loader_options_userMessageDelivered && isAuthorMode()) {
|
|
1359
|
-
const display = external_path_.basename(configPath);
|
|
1360
|
-
console.log(js_frameworks_lib_messages.Ty(display));
|
|
1361
|
-
load_loader_options_userMessageDelivered = true;
|
|
1362
|
-
}
|
|
1363
|
-
try {
|
|
1364
|
-
const module = await import((0, external_url_.pathToFileURL)(configPath).href);
|
|
1365
|
-
return module.default || module;
|
|
1366
|
-
} catch (err) {
|
|
1367
|
-
const error = err;
|
|
1368
|
-
console.error(`Error loading ${framework} loader options: ${error.message}`);
|
|
1369
|
-
throw err;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
return null;
|
|
1373
|
-
}
|
|
1374
|
-
let vue_userMessageDelivered = false;
|
|
1375
|
-
let cachedVueLoaderPlugin;
|
|
1376
|
-
function getVueLoaderPlugin() {
|
|
1377
|
-
if (cachedVueLoaderPlugin) return cachedVueLoaderPlugin;
|
|
1378
|
-
try {
|
|
1379
|
-
const mod = __webpack_require__("vue-loader");
|
|
1380
|
-
const plugin = mod && mod.VueLoaderPlugin || mod && mod.default && mod.default.VueLoaderPlugin;
|
|
1381
|
-
if (plugin) {
|
|
1382
|
-
cachedVueLoaderPlugin = plugin;
|
|
1383
|
-
return cachedVueLoaderPlugin;
|
|
1384
|
-
}
|
|
1385
|
-
} catch {}
|
|
1386
|
-
}
|
|
1387
|
-
function isUsingVue(projectPath) {
|
|
1388
|
-
const using = (0, frameworks_lib_integrations.ws)(projectPath, 'vue');
|
|
1389
|
-
if (using && !vue_userMessageDelivered) {
|
|
1390
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(`${external_pintor_default().brightMagenta('►►► Author says')} ${js_frameworks_lib_messages.zA('Vue')}`);
|
|
1391
|
-
vue_userMessageDelivered = true;
|
|
1392
|
-
}
|
|
1393
|
-
return using;
|
|
1394
|
-
}
|
|
1395
|
-
async function maybeUseVue(projectPath) {
|
|
1396
|
-
if (!isUsingVue(projectPath)) return;
|
|
1397
|
-
try {
|
|
1398
|
-
require.resolve('vue-loader');
|
|
1399
|
-
} catch (e) {
|
|
1400
|
-
const vueDependencies = [
|
|
1401
|
-
'vue-loader',
|
|
1402
|
-
'@vue/compiler-sfc'
|
|
1403
|
-
];
|
|
1404
|
-
await (0, frameworks_lib_integrations.tm)('Vue', vueDependencies);
|
|
1405
|
-
console.log(js_frameworks_lib_messages.Jv('Vue'));
|
|
1406
|
-
process.exit(0);
|
|
1407
|
-
}
|
|
1408
|
-
const VueLoaderPlugin = getVueLoaderPlugin();
|
|
1409
|
-
if (!VueLoaderPlugin) throw new Error('[Vue] vue-loader is installed but VueLoaderPlugin could not be resolved.');
|
|
1410
|
-
const customOptions = await loadLoaderOptions(projectPath, 'vue');
|
|
1411
|
-
const defaultLoaders = [
|
|
1412
|
-
{
|
|
1413
|
-
test: /\.vue$/,
|
|
1414
|
-
loader: require.resolve('vue-loader'),
|
|
1415
|
-
options: {
|
|
1416
|
-
experimentalInlineMatchResource: true,
|
|
1417
|
-
...customOptions || {}
|
|
1418
|
-
},
|
|
1419
|
-
include: projectPath,
|
|
1420
|
-
exclude: /node_modules/
|
|
1421
|
-
}
|
|
1422
|
-
];
|
|
1423
|
-
const defaultPlugins = [
|
|
1424
|
-
new VueLoaderPlugin()
|
|
1425
|
-
];
|
|
1426
|
-
return {
|
|
1427
|
-
plugins: defaultPlugins,
|
|
1428
|
-
loaders: defaultLoaders,
|
|
1429
|
-
alias: void 0
|
|
1430
|
-
};
|
|
1431
|
-
}
|
|
890
|
+
var preact = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/preact.ts");
|
|
891
|
+
var react = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/react.ts");
|
|
892
|
+
var vue = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/vue.ts");
|
|
1432
893
|
var typescript = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/typescript.ts");
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
try {
|
|
1436
|
-
return require.resolve(id, {
|
|
1437
|
-
paths: [
|
|
1438
|
-
projectPath,
|
|
1439
|
-
process.cwd()
|
|
1440
|
-
]
|
|
1441
|
-
});
|
|
1442
|
-
} catch {
|
|
1443
|
-
return;
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
function isUsingSvelte(projectPath) {
|
|
1447
|
-
const using = (0, frameworks_lib_integrations.ws)(projectPath, 'svelte');
|
|
1448
|
-
if (using && !svelte_userMessageDelivered) {
|
|
1449
|
-
if ('true' === process.env.EXTENSION_AUTHOR_MODE) console.log(js_frameworks_lib_messages.zA('Svelte'));
|
|
1450
|
-
svelte_userMessageDelivered = true;
|
|
1451
|
-
}
|
|
1452
|
-
return using;
|
|
1453
|
-
}
|
|
1454
|
-
async function maybeUseSvelte(projectPath, mode) {
|
|
1455
|
-
if (!isUsingSvelte(projectPath)) return;
|
|
1456
|
-
try {
|
|
1457
|
-
resolveFromProject('svelte-loader', projectPath) || require.resolve('svelte-loader');
|
|
1458
|
-
} catch (e) {
|
|
1459
|
-
const typeScriptDependencies = [
|
|
1460
|
-
"typescript"
|
|
1461
|
-
];
|
|
1462
|
-
await (0, frameworks_lib_integrations.tm)('TypeScript', typeScriptDependencies);
|
|
1463
|
-
const svelteDependencies = [
|
|
1464
|
-
'svelte-loader'
|
|
1465
|
-
];
|
|
1466
|
-
await (0, frameworks_lib_integrations.tm)('Svelte', svelteDependencies);
|
|
1467
|
-
console.log(js_frameworks_lib_messages.Jv('Svelte'));
|
|
1468
|
-
process.exit(0);
|
|
1469
|
-
}
|
|
1470
|
-
try {
|
|
1471
|
-
require.resolve("typescript", {
|
|
1472
|
-
paths: [
|
|
1473
|
-
projectPath,
|
|
1474
|
-
process.cwd()
|
|
1475
|
-
]
|
|
1476
|
-
});
|
|
1477
|
-
} catch (e) {
|
|
1478
|
-
const typeScriptDependencies = [
|
|
1479
|
-
"typescript"
|
|
1480
|
-
];
|
|
1481
|
-
await (0, frameworks_lib_integrations.tm)('TypeScript', typeScriptDependencies);
|
|
1482
|
-
console.log(js_frameworks_lib_messages.Jv('TypeScript'));
|
|
1483
|
-
process.exit(0);
|
|
1484
|
-
}
|
|
1485
|
-
const customOptions = await loadLoaderOptions(projectPath, 'svelte');
|
|
1486
|
-
const svelteLoaderPath = resolveFromProject('svelte-loader', projectPath) || require.resolve('svelte-loader');
|
|
1487
|
-
const defaultLoaders = [
|
|
1488
|
-
{
|
|
1489
|
-
test: /\.svelte\.ts$/,
|
|
1490
|
-
use: [
|
|
1491
|
-
svelteLoaderPath
|
|
1492
|
-
],
|
|
1493
|
-
include: projectPath,
|
|
1494
|
-
exclude: /node_modules/
|
|
1495
|
-
},
|
|
1496
|
-
{
|
|
1497
|
-
test: /\.(svelte|svelte\.js)$/,
|
|
1498
|
-
use: {
|
|
1499
|
-
loader: svelteLoaderPath,
|
|
1500
|
-
options: {
|
|
1501
|
-
emitCss: true,
|
|
1502
|
-
compilerOptions: {
|
|
1503
|
-
dev: 'development' === mode
|
|
1504
|
-
},
|
|
1505
|
-
hotReload: 'development' === mode,
|
|
1506
|
-
...customOptions || {}
|
|
1507
|
-
}
|
|
1508
|
-
},
|
|
1509
|
-
include: projectPath,
|
|
1510
|
-
exclude: /node_modules/
|
|
1511
|
-
},
|
|
1512
|
-
{
|
|
1513
|
-
test: /[\\/]node_modules[\\/]svelte[\\/].*\.mjs$/,
|
|
1514
|
-
resolve: {
|
|
1515
|
-
fullySpecified: false
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
];
|
|
1519
|
-
const alias = void 0;
|
|
1520
|
-
const resolverPlugin = {
|
|
1521
|
-
apply (compiler) {
|
|
1522
|
-
const existingMainFields = compiler.options.resolve && compiler.options.resolve.mainFields || [];
|
|
1523
|
-
const existingConditionNames = compiler.options.resolve && (compiler.options.resolve.conditionNames || compiler.options.resolve.conditions) || [];
|
|
1524
|
-
const existingExtensions = compiler.options.resolve && compiler.options.resolve.extensions || [];
|
|
1525
|
-
const existingAlias = compiler.options.resolve && compiler.options.resolve.alias || {};
|
|
1526
|
-
const existingModules = compiler.options.resolve && compiler.options.resolve.modules || [];
|
|
1527
|
-
const nextMainFields = [
|
|
1528
|
-
'svelte',
|
|
1529
|
-
'browser',
|
|
1530
|
-
'module',
|
|
1531
|
-
'main',
|
|
1532
|
-
...existingMainFields
|
|
1533
|
-
];
|
|
1534
|
-
const dedupe = (arr)=>Array.from(new Set(arr));
|
|
1535
|
-
compiler.options.resolve = {
|
|
1536
|
-
...compiler.options.resolve,
|
|
1537
|
-
mainFields: dedupe(nextMainFields),
|
|
1538
|
-
conditionNames: dedupe([
|
|
1539
|
-
'svelte',
|
|
1540
|
-
...existingConditionNames
|
|
1541
|
-
]),
|
|
1542
|
-
extensions: dedupe([
|
|
1543
|
-
'.svelte',
|
|
1544
|
-
...existingExtensions
|
|
1545
|
-
]),
|
|
1546
|
-
alias: existingAlias,
|
|
1547
|
-
modules: dedupe([
|
|
1548
|
-
external_path_.join(projectPath, 'node_modules'),
|
|
1549
|
-
...existingModules
|
|
1550
|
-
])
|
|
1551
|
-
};
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
return {
|
|
1555
|
-
plugins: [
|
|
1556
|
-
resolverPlugin
|
|
1557
|
-
],
|
|
1558
|
-
loaders: defaultLoaders,
|
|
1559
|
-
alias
|
|
1560
|
-
};
|
|
1561
|
-
}
|
|
894
|
+
var svelte = __webpack_require__("./webpack/plugin-js-frameworks/js-tools/svelte.ts");
|
|
895
|
+
var js_frameworks_lib_messages = __webpack_require__("./webpack/plugin-js-frameworks/js-frameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_js_frameworks_define_property(obj, key, value) {
|
|
1563
897
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
1564
898
|
value: value,
|
|
@@ -1573,10 +907,10 @@ exports.modules = {
|
|
|
1573
907
|
async configureOptions(compiler) {
|
|
1574
908
|
const mode = compiler.options.mode || 'development';
|
|
1575
909
|
const projectPath = compiler.options.context;
|
|
1576
|
-
const maybeInstallReact = await
|
|
1577
|
-
const maybeInstallPreact = await
|
|
1578
|
-
const maybeInstallVue = await
|
|
1579
|
-
const maybeInstallSvelte = await
|
|
910
|
+
const maybeInstallReact = await (0, react.b)(projectPath);
|
|
911
|
+
const maybeInstallPreact = await (0, preact.b)(projectPath);
|
|
912
|
+
const maybeInstallVue = await (0, vue.K)(projectPath);
|
|
913
|
+
const maybeInstallSvelte = await (0, svelte.X)(projectPath, mode);
|
|
1580
914
|
const tsConfigPath = (0, typescript.hB)(projectPath);
|
|
1581
915
|
const manifestDir = external_path_.dirname(this.manifestPath);
|
|
1582
916
|
const tsRoot = tsConfigPath ? external_path_.dirname(tsConfigPath) : manifestDir;
|
|
@@ -1632,8 +966,8 @@ exports.modules = {
|
|
|
1632
966
|
jsc: {
|
|
1633
967
|
parser: {
|
|
1634
968
|
syntax: preferTypeScript ? "typescript" : "ecmascript",
|
|
1635
|
-
tsx: preferTypeScript ? true : (0, typescript.eE)(projectPath) && (
|
|
1636
|
-
jsx: !preferTypeScript && (
|
|
969
|
+
tsx: preferTypeScript ? true : (0, typescript.eE)(projectPath) && ((0, react.S)(projectPath) || (0, preact.K)(projectPath)),
|
|
970
|
+
jsx: !preferTypeScript && ((0, react.S)(projectPath) || (0, preact.K)(projectPath)),
|
|
1637
971
|
dynamicImport: true
|
|
1638
972
|
},
|
|
1639
973
|
transform: {
|
|
@@ -1642,7 +976,7 @@ exports.modules = {
|
|
|
1642
976
|
refresh: 'development' === mode,
|
|
1643
977
|
runtime: 'automatic',
|
|
1644
978
|
importSource: 'react',
|
|
1645
|
-
...
|
|
979
|
+
...(0, preact.K)(projectPath) ? {
|
|
1646
980
|
pragma: 'h',
|
|
1647
981
|
pragmaFrag: 'Fragment',
|
|
1648
982
|
throwIfNamespace: true,
|