@rsdoctor/utils 0.1.3 → 0.1.4

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.
@@ -29,7 +29,8 @@ __export(loader_exports, {
29
29
  getLoaderFolderStatistics: () => getLoaderFolderStatistics,
30
30
  getLoaderNames: () => getLoaderNames,
31
31
  getLoadersCosts: () => getLoadersCosts,
32
- getLoadersTransformData: () => getLoadersTransformData
32
+ getLoadersTransformData: () => getLoadersTransformData,
33
+ isVue: () => isVue
33
34
  });
34
35
  module.exports = __toCommonJS(loader_exports);
35
36
  var import_algorithm = require("./algorithm");
@@ -232,6 +233,16 @@ function getLoaderFileInputAndOutput(file, loader, loaderIndex, loaders) {
232
233
  };
233
234
  }
234
235
  const LoaderInternalPropertyName = "__l__";
236
+ const isVue = (compiler) => {
237
+ const rules = compiler.options.module.rules;
238
+ const hasVueRule = rules.some((rule) => {
239
+ if (rule && typeof rule === "object" && rule.test instanceof RegExp && rule.test?.test(".vue")) {
240
+ return true;
241
+ }
242
+ return false;
243
+ });
244
+ return hasVueRule;
245
+ };
235
246
  // Annotate the CommonJS export names for ESM import in node:
236
247
  0 && (module.exports = {
237
248
  LoaderInternalPropertyName,
@@ -245,5 +256,6 @@ const LoaderInternalPropertyName = "__l__";
245
256
  getLoaderFolderStatistics,
246
257
  getLoaderNames,
247
258
  getLoadersCosts,
248
- getLoadersTransformData
259
+ getLoadersTransformData,
260
+ isVue
249
261
  });
@@ -198,6 +198,16 @@ function getLoaderFileInputAndOutput(file, loader, loaderIndex, loaders) {
198
198
  };
199
199
  }
200
200
  const LoaderInternalPropertyName = "__l__";
201
+ const isVue = (compiler) => {
202
+ const rules = compiler.options.module.rules;
203
+ const hasVueRule = rules.some((rule) => {
204
+ if (rule && typeof rule === "object" && rule.test instanceof RegExp && rule.test?.test(".vue")) {
205
+ return true;
206
+ }
207
+ return false;
208
+ });
209
+ return hasVueRule;
210
+ };
201
211
  export {
202
212
  LoaderInternalPropertyName,
203
213
  findLoaderTotalTiming,
@@ -210,5 +220,6 @@ export {
210
220
  getLoaderFolderStatistics,
211
221
  getLoaderNames,
212
222
  getLoadersCosts,
213
- getLoadersTransformData
223
+ getLoadersTransformData,
224
+ isVue
214
225
  };
@@ -1,4 +1,5 @@
1
1
  import { SDK } from '@rsdoctor/types';
2
+ import { Plugin } from '@rsdoctor/types';
2
3
  export declare function findLoaderTotalTiming(loaders: Pick<SDK.LoaderTransformData, 'startAt' | 'endAt'>[]): {
3
4
  start: number;
4
5
  end: number;
@@ -14,3 +15,4 @@ export declare function getLoaderFolderStatistics(folder: string, loaders: SDK.L
14
15
  export declare function getLoaderFileFirstInput(file: string, loaders: SDK.LoaderData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileFirstInput>;
15
16
  export declare function getLoaderFileInputAndOutput(file: string, loader: string, loaderIndex: number, loaders: SDK.LoaderData): SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileInputAndOutput>;
16
17
  export declare const LoaderInternalPropertyName = "__l__";
18
+ export declare const isVue: (compiler: Plugin.BaseCompiler) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/utils",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -62,7 +62,7 @@
62
62
  "lodash": "^4.17.21",
63
63
  "rslog": "^1.2.0",
64
64
  "strip-ansi": "^6.0.1",
65
- "@rsdoctor/types": "0.1.3"
65
+ "@rsdoctor/types": "0.1.4"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/deep-eql": "4.0.0",