@meteorjs/rspack 0.2.50 → 0.2.52
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/lib/test.js +17 -2
- package/package.json +1 -1
- package/rspack.config.js +1 -0
package/lib/test.js
CHANGED
|
@@ -9,6 +9,7 @@ const { createIgnoreRegex, createIgnoreGlobConfig } = require("./ignore.js");
|
|
|
9
9
|
* @param {string} options.projectDir - The project directory
|
|
10
10
|
* @param {string} options.buildContext - The build context
|
|
11
11
|
* @param {string[]} options.ignoreEntries - Array of ignore patterns
|
|
12
|
+
* @param {string} options.extraEntry - Extra entry to load
|
|
12
13
|
* @returns {string} The path to the generated file
|
|
13
14
|
*/
|
|
14
15
|
const generateEagerTestFile = ({
|
|
@@ -17,6 +18,7 @@ const generateEagerTestFile = ({
|
|
|
17
18
|
buildContext,
|
|
18
19
|
ignoreEntries: inIgnoreEntries = [],
|
|
19
20
|
prefix: inPrefix = '',
|
|
21
|
+
extraEntry,
|
|
20
22
|
}) => {
|
|
21
23
|
const distDir = path.resolve(projectDir, ".meteor/local/test");
|
|
22
24
|
if (!fs.existsSync(distDir)) {
|
|
@@ -38,7 +40,7 @@ const generateEagerTestFile = ({
|
|
|
38
40
|
createIgnoreGlobConfig(ignoreEntries)
|
|
39
41
|
);
|
|
40
42
|
|
|
41
|
-
const prefix = inPrefix && `${inPrefix}-` ||
|
|
43
|
+
const prefix = (inPrefix && `${inPrefix}-`) || "";
|
|
42
44
|
const filename = isAppTest
|
|
43
45
|
? `${prefix}eager-app-tests.mjs`
|
|
44
46
|
: `${prefix}eager-tests.mjs`;
|
|
@@ -47,7 +49,8 @@ const generateEagerTestFile = ({
|
|
|
47
49
|
? "/\\.app-(?:test|spec)s?\\.[^.]+$/"
|
|
48
50
|
: "/\\.(?:test|spec)s?\\.[^.]+$/";
|
|
49
51
|
|
|
50
|
-
const content = `
|
|
52
|
+
const content = `${extraEntry ? `import path from 'path';` : ''}
|
|
53
|
+
{
|
|
51
54
|
const ctx = import.meta.webpackContext('/', {
|
|
52
55
|
recursive: true,
|
|
53
56
|
regExp: ${regExp},
|
|
@@ -55,6 +58,18 @@ const generateEagerTestFile = ({
|
|
|
55
58
|
mode: 'eager',
|
|
56
59
|
});
|
|
57
60
|
ctx.keys().forEach(ctx);
|
|
61
|
+
${
|
|
62
|
+
extraEntry
|
|
63
|
+
? `const extra = import.meta.webpackContext('${path.dirname(
|
|
64
|
+
extraEntry
|
|
65
|
+
)}', {
|
|
66
|
+
recursive: false,
|
|
67
|
+
include: new RegExp(\`^\\\\./${path.basename(extraEntry)}$\`),
|
|
68
|
+
mode: 'eager',
|
|
69
|
+
});
|
|
70
|
+
extra.keys().forEach(extra);`
|
|
71
|
+
: ''
|
|
72
|
+
}
|
|
58
73
|
}`;
|
|
59
74
|
|
|
60
75
|
fs.writeFileSync(filePath, content);
|
package/package.json
CHANGED
package/rspack.config.js
CHANGED
|
@@ -421,6 +421,7 @@ module.exports = async function (inMeteor = {}, argv = {}) {
|
|
|
421
421
|
buildContext,
|
|
422
422
|
ignoreEntries: [...meteorIgnoreEntries, "**/server/**"],
|
|
423
423
|
prefix: "client",
|
|
424
|
+
extraEntry: path.resolve(process.cwd(), Meteor.mainClientEntry),
|
|
424
425
|
})
|
|
425
426
|
: isTest && isTestEager
|
|
426
427
|
? generateEagerTestFile({
|