@modern-js/module-tools 1.1.5 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @modern-js/module-tools
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cfe11628: Make Modern.js self bootstraping
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [2da09c69]
12
+ - Updated dependencies [fc71e36f]
13
+ - Updated dependencies [2c049918]
14
+ - Updated dependencies [c3d46ee4]
15
+ - Updated dependencies [cfe11628]
16
+ - Updated dependencies [1ebc7ee2]
17
+ - Updated dependencies [146dcd85]
18
+ - Updated dependencies [1ebc7ee2]
19
+ - @modern-js/utils@1.2.0
20
+ - @modern-js/core@1.3.0
21
+ - @modern-js/new-action@1.3.0
22
+ - @modern-js/babel-preset-module@1.2.0
23
+ - @modern-js/css-config@1.2.0
24
+ - @modern-js/i18n-cli-language-detector@1.2.0
25
+ - @modern-js/plugin-analyze@1.2.0
26
+ - @modern-js/plugin-changeset@1.2.0
27
+ - @modern-js/plugin-fast-refresh@1.2.0
28
+ - @modern-js/plugin-i18n@1.2.0
29
+ - @modern-js/babel-compiler@1.2.0
30
+ - @modern-js/style-compiler@1.2.0
31
+ - @modern-js/module-tools-hooks@1.2.0
32
+
3
33
  ## 1.1.5
4
34
 
5
35
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import type { Platform } from "../types.d";
1
+ import type { Platform } from '../types';
2
2
  export interface IBuildOption {
3
3
  watch: boolean;
4
4
  tsconfig: string;
@@ -1,4 +1,4 @@
1
- export declare const defineConfig: (config: import("@modern-js/core/config").ConfigParam) => import("@modern-js/core/config").ConfigParam;
1
+ export declare const defineConfig: (config: import("@modern-js/core/src/config").ConfigParam) => import("@modern-js/core/src/config").ConfigParam;
2
2
 
3
3
  declare const _default: import("@modern-js/core").AsyncPlugin<Partial<import("@modern-js/core").Progresses2Threads<{
4
4
  config: import("@modern-js/core").ParallelWorkflow<void, unknown>;
package/jest.config.js ADDED
@@ -0,0 +1,8 @@
1
+ const sharedConfig = require('@scripts/jest-config');
2
+
3
+ /** @type {import('@jest/types').Config.InitialOptions} */
4
+ module.exports = {
5
+ // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
+ ...sharedConfig,
7
+ rootDir: __dirname,
8
+ };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.1.5",
14
+ "version": "1.2.0",
15
15
  "bin": {
16
16
  "modern": "./bin/modern.js"
17
17
  },
@@ -23,13 +23,20 @@
23
23
  "exports": {
24
24
  ".": {
25
25
  "node": {
26
+ "jsnext:source": "./src/index.ts",
26
27
  "import": "./dist/js/modern/index.js",
27
28
  "require": "./dist/js/node/index.js"
28
29
  },
29
30
  "default": "./dist/js/treeshaking/index.js"
30
31
  },
31
- "./cli": "./dist/js/node/index.js",
32
- "./build": "./dist/js/node/build.js"
32
+ "./cli": {
33
+ "jsnext:source": "./src/index.ts",
34
+ "default": "./dist/js/node/index.js"
35
+ },
36
+ "./build": {
37
+ "jsnext:source": "./src/build.ts",
38
+ "default": "./dist/js/node/build.js"
39
+ }
33
40
  },
34
41
  "typesVersions": {
35
42
  "*": {
@@ -44,19 +51,19 @@
44
51
  "@babel/runtime": "^7",
45
52
  "@babel/traverse": "^7.15.0",
46
53
  "@babel/types": "^7.15.0",
47
- "@modern-js/babel-compiler": "^1.1.4",
48
- "@modern-js/babel-preset-module": "^1.1.2",
49
- "@modern-js/core": "^1.2.0",
50
- "@modern-js/css-config": "^1.1.2",
51
- "@modern-js/i18n-cli-language-detector": "^1.1.1",
52
- "@modern-js/module-tools-hooks": "^1.1.2",
53
- "@modern-js/new-action": "^1.2.1",
54
- "@modern-js/plugin-analyze": "^1.1.2",
55
- "@modern-js/plugin-changeset": "^1.1.2",
56
- "@modern-js/plugin-fast-refresh": "^1.1.1",
57
- "@modern-js/plugin-i18n": "^1.1.2",
58
- "@modern-js/style-compiler": "^1.1.3",
59
- "@modern-js/utils": "^1.1.6",
54
+ "@modern-js/babel-compiler": "^1.2.0",
55
+ "@modern-js/babel-preset-module": "^1.2.0",
56
+ "@modern-js/core": "^1.3.0",
57
+ "@modern-js/css-config": "^1.2.0",
58
+ "@modern-js/i18n-cli-language-detector": "^1.2.0",
59
+ "@modern-js/module-tools-hooks": "^1.2.0",
60
+ "@modern-js/new-action": "^1.3.0",
61
+ "@modern-js/plugin-analyze": "^1.2.0",
62
+ "@modern-js/plugin-changeset": "^1.2.0",
63
+ "@modern-js/plugin-fast-refresh": "^1.2.0",
64
+ "@modern-js/plugin-i18n": "^1.2.0",
65
+ "@modern-js/style-compiler": "^1.2.0",
66
+ "@modern-js/utils": "^1.2.0",
60
67
  "chalk": "^4.1.2",
61
68
  "chokidar": "^3.5.2",
62
69
  "dotenv": "^10.0.0",
@@ -75,7 +82,7 @@
75
82
  },
76
83
  "devDependencies": {
77
84
  "@babel/preset-typescript": "^7.15.0",
78
- "@modern-js/babel-chain": "^1.1.2",
85
+ "@modern-js/babel-chain": "^1.2.0",
79
86
  "@types/babel__core": "^7.1.15",
80
87
  "@types/babel__generator": "^7.6.3",
81
88
  "@types/babel__traverse": "^7.14.2",
@@ -88,8 +95,9 @@
88
95
  "@types/signale": "^1.4.2",
89
96
  "commander": "^8.1.0",
90
97
  "typescript": "^4",
91
- "@modern-js/plugin-testing": "^1.2.2",
92
- "@modern-js/module-tools": "^1.1.4"
98
+ "@scripts/build": "0.0.0",
99
+ "jest": "^27",
100
+ "@scripts/jest-config": "0.0.0"
93
101
  },
94
102
  "sideEffects": false,
95
103
  "modernConfig": {
@@ -99,12 +107,13 @@
99
107
  },
100
108
  "publishConfig": {
101
109
  "registry": "https://registry.npmjs.org/",
102
- "access": "public"
110
+ "access": "public",
111
+ "types": "./dist/types/index.d.ts"
103
112
  },
104
113
  "scripts": {
105
114
  "new": "modern new",
106
115
  "build": "modern build",
107
- "test": "modern test --passWithNoTests"
116
+ "test": "jest --passWithNoTests"
108
117
  },
109
118
  "readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
110
119
  }
package/src/cli/dev.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Import } from '@modern-js/utils';
2
2
  import type { Command } from 'commander';
3
- import type { IDevOption } from '@/commands/dev';
3
+ import type { IDevOption } from '../commands/dev';
4
4
 
5
5
  const local: typeof import('../locale') = Import.lazy('../locale', require);
6
6
  const commands: typeof import('../commands') = Import.lazy(
@@ -1,6 +1,6 @@
1
1
  import * as path from 'path';
2
2
  import { fs, Import } from '@modern-js/utils';
3
- import type { Platform } from '@/types';
3
+ import type { Platform } from '../types';
4
4
 
5
5
  const tsConfigutils: typeof import('../utils/tsconfig') = Import.lazy(
6
6
  '../utils/tsconfig',
@@ -3,7 +3,7 @@ import * as path from 'path';
3
3
  import * as os from 'os';
4
4
  import { Import, fs } from '@modern-js/utils';
5
5
  import type { NormalizedConfig, CoreOptions } from '@modern-js/core';
6
- import type { ITsconfig } from '@/types';
6
+ import type { ITsconfig } from '../types';
7
7
 
8
8
  const tsPathsTransform: typeof import('../utils/tspaths-transform') =
9
9
  Import.lazy('../utils/tspaths-transform', require);
@@ -0,0 +1 @@
1
+ import '@/b.ts';
@@ -0,0 +1 @@
1
+ export const b = 10;
@@ -0,0 +1,7 @@
1
+ import plugin from '../src';
2
+
3
+ describe('module-tools', () => {
4
+ it('default', () => {
5
+ expect(plugin).toBeDefined();
6
+ });
7
+ });
@@ -0,0 +1,21 @@
1
+ import path from 'path';
2
+ import { transformDtsAlias } from '../src/utils/tspaths-transform';
3
+
4
+ describe('tspaths-transform', () => {
5
+ it('transformDtsAlias', () => {
6
+ const filepath = path.join(__dirname, 'fixtures/tspaths/a.ts');
7
+ const options = {
8
+ filenames: [filepath],
9
+ baseUrl: './',
10
+ paths: {
11
+ '@/*': ['./*'],
12
+ },
13
+ };
14
+ expect(transformDtsAlias(options)).toEqual([
15
+ {
16
+ path: filepath,
17
+ content: "import '@/b.ts';",
18
+ },
19
+ ]);
20
+ });
21
+ });
package/tsconfig.json CHANGED
@@ -5,9 +5,7 @@
5
5
  "jsx": "preserve",
6
6
  "baseUrl": "./",
7
7
  "isolatedModules": true,
8
- "paths": {
9
- "@/*": ["./src/*"]
10
- }
8
+ "paths": {}
11
9
  },
12
10
  "include": ["src"]
13
11
  }