@umijs/plugins 4.2.10 → 4.2.12

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.
@@ -1,5 +1,7 @@
1
1
  import * as t from '@umijs/bundler-utils/compiled/babel/types';
2
+ import { type TransformResult } from '@umijs/bundler-utils/compiled/esbuild';
2
3
  import { IApi } from 'umi';
4
+ export declare function transformSync(content: any, opts: any): TransformResult<any>;
3
5
  interface IOpts {
4
6
  contentTest?: (content: string) => Boolean;
5
7
  astTest?: (opts: {
@@ -31,7 +31,8 @@ var modelUtils_exports = {};
31
31
  __export(modelUtils_exports, {
32
32
  Model: () => Model,
33
33
  ModelUtils: () => ModelUtils,
34
- getNamespace: () => getNamespace
34
+ getNamespace: () => getNamespace,
35
+ transformSync: () => transformSync
35
36
  });
36
37
  module.exports = __toCommonJS(modelUtils_exports);
37
38
  var import_bundler_utils = require("@umijs/bundler-utils");
@@ -43,6 +44,12 @@ var import_fs = require("fs");
43
44
  var import_path = require("path");
44
45
  var import_plugin_utils = require("umi/plugin-utils");
45
46
  var import_astUtils = require("./astUtils");
47
+ function transformSync(content, opts) {
48
+ if (!opts.tsconfig && !opts.tsconfigRaw) {
49
+ opts.tsconfigRaw = { compilerOptions: { experimentalDecorators: true } };
50
+ }
51
+ return (0, import_esbuild.transformSync)(content, opts);
52
+ }
46
53
  function getNamespace(absFilePath, absSrcPath) {
47
54
  const relPath = (0, import_plugin_utils.winPath)((0, import_path.relative)((0, import_plugin_utils.winPath)(absSrcPath), (0, import_plugin_utils.winPath)(absFilePath)));
48
55
  const parts = relPath.split("/");
@@ -77,7 +84,7 @@ var Model = class {
77
84
  findDeps(sort) {
78
85
  const content = (0, import_fs.readFileSync)(this.file, "utf-8");
79
86
  const loader = (0, import_path.extname)(this.file).slice(1);
80
- const result = (0, import_esbuild.transformSync)(content, {
87
+ const result = transformSync(content, {
81
88
  loader,
82
89
  sourcemap: false,
83
90
  minify: false
@@ -167,7 +174,7 @@ var _ModelUtils = class {
167
174
  try {
168
175
  const ext = (0, import_path.extname)(file).slice(1);
169
176
  const loader = ext === "js" ? "jsx" : ext;
170
- result = (0, import_esbuild.transformSync)(content, {
177
+ result = transformSync(content, {
171
178
  loader,
172
179
  sourcemap: false,
173
180
  minify: false,
@@ -282,5 +289,6 @@ ModelUtils.topologicalSort = (models) => {
282
289
  0 && (module.exports = {
283
290
  Model,
284
291
  ModelUtils,
285
- getNamespace
292
+ getNamespace,
293
+ transformSync
286
294
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.2.10",
3
+ "version": "4.2.12",
4
4
  "description": "@umijs/plugins",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -45,12 +45,12 @@
45
45
  "styled-components": "6.1.1",
46
46
  "tslib": "^2",
47
47
  "warning": "^4.0.3",
48
- "@umijs/bundler-utils": "4.2.10",
48
+ "@umijs/bundler-utils": "4.2.12",
49
49
  "@umijs/valtio": "1.0.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "antd": "^4.24.1",
53
- "umi": "4.2.10"
53
+ "umi": "4.2.12"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"