@meteorjs/rspack 0.0.14 → 0.0.16

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ const ctx = import.meta.webpackContext('/', {
3
+ recursive: true,
4
+ regExp: /\.(?:app-)?(?:test|spec)s?\.[^.]+$/,
5
+ exclude: /(^|\/)(node_modules|\.meteor|_build)(\/|$)/,
6
+ mode: 'eager',
7
+ });
8
+ ctx.keys().forEach(ctx);
9
+ }
@@ -55,7 +55,7 @@ function ruleMatchesExt(rule, ext) {
55
55
  */
56
56
  function regexFromExts(exts) {
57
57
  const body = exts.map(e => e.replace(/^\./, '')).join('|');
58
- return new RegExp(`\\.(${body})$`);
58
+ return new RegExp(`\\.(${body})$`, 'i');
59
59
  }
60
60
 
61
61
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meteorjs/rspack",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Configuration logic for using Rspack in Meteor projects",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/rspack.config.js CHANGED
@@ -77,7 +77,7 @@ function createSwcConfig({ isTypescriptEnabled, isJsxEnabled, isTsxEnabled, exte
77
77
  // Coffeescript rule
78
78
  function createCoffeescriptConfig({ swcConfig }) {
79
79
  return {
80
- test: /\.coffee$/,
80
+ test: /\.coffee$/i,
81
81
  use: [
82
82
  {
83
83
  loader: 'swc-loader',
@@ -91,7 +91,7 @@ function createCoffeescriptConfig({ swcConfig }) {
91
91
  }
92
92
 
93
93
  // Watch options shared across both builds
94
- const watchOptions = {
94
+ const defaultWatchOptions = {
95
95
  ignored: ['**/.meteor/local/**', '**/dist/**'],
96
96
  };
97
97
 
@@ -119,6 +119,7 @@ export default function (inMeteor = {}, argv = {}) {
119
119
  const isRun = Meteor.isRun;
120
120
  const isReactEnabled = Meteor.isReactEnabled;
121
121
  const isTestModule = Meteor.isTestModule;
122
+ const isTestEager = Meteor.isTestEager;
122
123
  const swcExternalHelpers = Meteor.swcExternalHelpers;
123
124
  const mode = isProd ? 'production' : 'development';
124
125
 
@@ -152,6 +153,19 @@ export default function (inMeteor = {}, argv = {}) {
152
153
  const bundlesContext = Meteor.bundlesContext || 'bundles';
153
154
  const assetsContext = Meteor.assetsContext || 'assets';
154
155
 
156
+ // Set watch options
157
+ const watchOptions = {
158
+ ...defaultWatchOptions,
159
+ ...isTestEager && {
160
+ ignored: [
161
+ ...defaultWatchOptions.ignored,
162
+ '**/_build/**',
163
+ '**/.meteor/local/**',
164
+ '**/node_modules/**',
165
+ ],
166
+ },
167
+ };
168
+
155
169
  if (Meteor.isDebug || Meteor.isVerbose) {
156
170
  console.log('[i] Rspack mode:', mode);
157
171
  console.log('[i] Meteor flags:', Meteor);
@@ -231,7 +245,7 @@ export default function (inMeteor = {}, argv = {}) {
231
245
  ...(Meteor.isBlazeEnabled
232
246
  ? [
233
247
  {
234
- test: /\.html$/,
248
+ test: /\.html$/i,
235
249
  loader: 'ignore-loader',
236
250
  },
237
251
  ]
@@ -282,7 +296,9 @@ export default function (inMeteor = {}, argv = {}) {
282
296
  name: serverNameConfig,
283
297
  target: 'node',
284
298
  mode,
285
- entry: path.resolve(process.cwd(), buildContext, entryPath),
299
+ entry: isTestEager
300
+ ? "node_modules/@meteorjs/rspack/entries/eager-tests.js"
301
+ : path.resolve(process.cwd(), buildContext, entryPath),
286
302
  output: {
287
303
  path: serverOutputDir,
288
304
  filename: () => `../${buildContext}/${outputPath}`,
@@ -308,13 +324,20 @@ export default function (inMeteor = {}, argv = {}) {
308
324
  },
309
325
  externals,
310
326
  plugins: [
311
- new DefinePlugin({
312
- 'Meteor.isClient': JSON.stringify(false),
313
- 'Meteor.isServer': JSON.stringify(true),
314
- 'Meteor.isTest': JSON.stringify(isTest),
315
- 'Meteor.isDevelopment': JSON.stringify(isDev),
316
- 'Meteor.isProduction': JSON.stringify(isProd),
317
- }),
327
+ new DefinePlugin(
328
+ isTestModule || isTestEager
329
+ ? {
330
+ "Meteor.isTest": JSON.stringify(isTest),
331
+ "Meteor.isDevelopment": JSON.stringify(isDev),
332
+ }
333
+ : {
334
+ "Meteor.isClient": JSON.stringify(true),
335
+ "Meteor.isServer": JSON.stringify(false),
336
+ "Meteor.isTest": JSON.stringify(isTest),
337
+ "Meteor.isDevelopment": JSON.stringify(isDev),
338
+ "Meteor.isProduction": JSON.stringify(isProd),
339
+ }
340
+ ),
318
341
  new BannerPlugin({
319
342
  banner: bannerOutput,
320
343
  entryOnly: true,
@@ -323,7 +346,7 @@ export default function (inMeteor = {}, argv = {}) {
323
346
  ],
324
347
  watchOptions,
325
348
  devtool: isDevEnvironment || isTest ? 'source-map' : 'hidden-source-map',
326
- ...((isDevEnvironment || isTest) &&
349
+ ...((isDevEnvironment || isTest && !isTestEager) &&
327
350
  createCacheStrategy(mode)
328
351
  ),
329
352
  };