@modern-js/module-tools 2.58.1 → 2.58.2
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/dist/builder/copy.js +0 -1
- package/dist/builder/esbuild/adapter.d.ts +1 -1
- package/dist/builder/esbuild/hook.d.ts +1 -1
- package/dist/builder/esbuild/index.d.ts +3 -3
- package/dist/builder/esbuild/resolve.d.ts +1 -1
- package/dist/builder/esbuild/sourcemap.d.ts +1 -1
- package/dist/builder/esbuild/sourcemap.js +1 -1
- package/dist/builder/esbuild/transform.d.ts +1 -1
- package/dist/builder/esbuild/watch.d.ts +1 -1
- package/dist/builder/esbuild/write-file.d.ts +1 -1
- package/dist/builder/feature/format-cjs.d.ts +1 -1
- package/dist/builder/feature/index.d.ts +1 -1
- package/dist/builder/feature/json.d.ts +1 -1
- package/dist/builder/feature/redirect.d.ts +1 -1
- package/dist/builder/feature/style/index.d.ts +1 -1
- package/dist/builder/feature/style/lessAliasPlugin.d.ts +1 -1
- package/dist/builder/feature/style/lessRender.d.ts +1 -1
- package/dist/builder/feature/style/postcssTransformer.d.ts +1 -1
- package/dist/builder/feature/style/postcssUrlPlugin.d.ts +2 -2
- package/dist/builder/feature/style/sassRender.d.ts +1 -1
- package/dist/builder/feature/style/transformStyle.d.ts +2 -2
- package/dist/builder/feature/terser.d.ts +1 -1
- package/dist/builder/platform.d.ts +3 -3
- package/dist/config/merge.d.ts +1 -1
- package/dist/hooks/build.d.ts +1 -1
- package/dist/hooks/misc.d.ts +1 -1
- package/dist/types/config/index.d.ts +2 -2
- package/dist/types/config/style.d.ts +1 -1
- package/dist/types/esbuild.d.ts +4 -4
- package/dist/types/hooks.d.ts +2 -2
- package/dist/types/legacyConfig/output.d.ts +1 -1
- package/dist/utils/dts.js +1 -1
- package/dist/utils/input.d.ts +1 -1
- package/dist/utils/print.d.ts +1 -1
- package/dist/utils/print.js +1 -1
- package/package.json +12 -12
- package/shims/cjs.js +1 -4
- package/vitest.config.ts +1 -1
package/dist/builder/copy.js
CHANGED
|
@@ -92,7 +92,6 @@ const runPatterns = async (pattern, options) => {
|
|
|
92
92
|
globOptions.dot = true;
|
|
93
93
|
}
|
|
94
94
|
break;
|
|
95
|
-
case "glob":
|
|
96
95
|
default: {
|
|
97
96
|
var _targetPattern_context;
|
|
98
97
|
glob = import_path.default.isAbsolute(from) ? from : import_path.default.posix.join(import_utils.fastGlob.escapePath(normalizePath(import_path.default.resolve((_targetPattern_context = targetPattern.context) !== null && _targetPattern_context !== void 0 ? _targetPattern_context : appDirectory))), from);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as tapable from 'tapable';
|
|
2
|
-
import { Source, Chunk, ICompiler } from '../../types';
|
|
2
|
+
import type { Source, Chunk, ICompiler } from '../../types';
|
|
3
3
|
export declare function createTransformHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Source, tapable.UnsetAdditionalOptions>;
|
|
4
4
|
export declare function createRenderChunkHook(compiler: ICompiler): tapable.AsyncSeriesWaterfallHook<Chunk, tapable.UnsetAdditionalOptions>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BuildResult, BuildOptions, BuildContext, ImportKind } from 'esbuild';
|
|
2
|
-
import { FSWatcher } from '@modern-js/utils';
|
|
3
|
-
import { BaseBuildConfig, BuilderHooks, Chunk, ICompiler, ModuleTools, PluginAPI, Context, HookList } from '../../types';
|
|
1
|
+
import { type BuildResult, type BuildOptions, type BuildContext, type ImportKind } from 'esbuild';
|
|
2
|
+
import { type FSWatcher } from '@modern-js/utils';
|
|
3
|
+
import type { BaseBuildConfig, BuilderHooks, Chunk, ICompiler, ModuleTools, PluginAPI, Context, HookList } from '../../types';
|
|
4
4
|
import { TransformContext } from './transform';
|
|
5
5
|
import { SourcemapContext } from './sourcemap';
|
|
6
6
|
export declare class EsbuildCompiler implements ICompiler {
|
|
@@ -55,7 +55,7 @@ class SourcemapContext {
|
|
|
55
55
|
return this.cachedSourceMap;
|
|
56
56
|
}
|
|
57
57
|
getSourceMapChain() {
|
|
58
|
-
return this.sourceMapChain.filter((m) => Boolean(m
|
|
58
|
+
return this.sourceMapChain.filter((m) => Boolean(m === null || m === void 0 ? void 0 : m.mappings));
|
|
59
59
|
}
|
|
60
60
|
genPluginId(name) {
|
|
61
61
|
if (this.pluginIdMap.has(name)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITransformContext, CacheValue } from '../../types';
|
|
1
|
+
import type { ITransformContext, CacheValue } from '../../types';
|
|
2
2
|
import { SourcemapContext } from './sourcemap';
|
|
3
3
|
export declare class TransformContext extends SourcemapContext implements ITransformContext {
|
|
4
4
|
private cachedTransformResult;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICompiler } from '../../types';
|
|
1
|
+
import type { ICompiler } from '../../types';
|
|
2
2
|
export declare const initWatcher: (compiler: ICompiler) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ICompiler } from '../../types';
|
|
1
|
+
import type { ICompiler } from '../../types';
|
|
2
2
|
export declare const writeFile: (compiler: ICompiler) => Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HookList, Context } from '../../types';
|
|
1
|
+
import type { HookList, Context } from '../../types';
|
|
2
2
|
export declare function getInternalList(context: Context): Promise<HookList>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PreprocessRender } from './transformStyle';
|
|
1
|
+
import type { PreprocessRender } from './transformStyle';
|
|
2
2
|
export declare const lessRender: PreprocessRender;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICompiler } from '../../../types';
|
|
1
|
+
import type { ICompiler } from '../../../types';
|
|
2
2
|
export declare const isCssModule: (filePath: string, autoModules: boolean | RegExp) => boolean;
|
|
3
3
|
export declare const postcssTransformer: (css: string, entryPath: string, compilation: ICompiler) => Promise<{
|
|
4
4
|
code: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Plugin } from 'postcss';
|
|
2
|
-
import { ICompiler } from '../../../types';
|
|
1
|
+
import type { Plugin } from 'postcss';
|
|
2
|
+
import type { ICompiler } from '../../../types';
|
|
3
3
|
export declare const postcssUrlPlugin: (options: {
|
|
4
4
|
entryPath: string;
|
|
5
5
|
compilation: ICompiler;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PreprocessRender } from './transformStyle';
|
|
1
|
+
import type { PreprocessRender } from './transformStyle';
|
|
2
2
|
export declare const sassRender: PreprocessRender;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { PartialMessage } from 'esbuild';
|
|
3
|
-
import { ICompiler, Source } from '../../../types';
|
|
2
|
+
import type { PartialMessage } from 'esbuild';
|
|
3
|
+
import type { ICompiler, Source } from '../../../types';
|
|
4
4
|
export type PreprocessRender = (content: string, stdinPath: string, stdinDir: string, preprocessOptions: any, resolvePathMap: Map<string, string>, implementation?: object | string) => Promise<{
|
|
5
5
|
css: Buffer | string;
|
|
6
6
|
errors?: PartialMessage[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginAPI } from '@modern-js/core';
|
|
2
|
-
import { ModuleContext } from '../types/context';
|
|
3
|
-
import { BuildCommandOptions, ModuleTools } from '../types';
|
|
1
|
+
import type { PluginAPI } from '@modern-js/core';
|
|
2
|
+
import type { ModuleContext } from '../types/context';
|
|
3
|
+
import type { BuildCommandOptions, ModuleTools } from '../types';
|
|
4
4
|
export declare const buildPlatform: (options: BuildCommandOptions, api: PluginAPI<ModuleTools>, context: ModuleContext) => Promise<void>;
|
package/dist/config/merge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleContext } from '../types';
|
|
1
|
+
import type { ModuleContext } from '../types';
|
|
2
2
|
import type { BaseBuildConfig, PartialBaseBuildConfig, ModuleLegacyUserConfig, BuildCommandOptions } from '../types';
|
|
3
3
|
export declare const mergeDefaultBaseConfig: (pConfig: PartialBaseBuildConfig, options: {
|
|
4
4
|
context: ModuleContext;
|
package/dist/hooks/build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RegisterBuildPlatformResult } from '@modern-js/core';
|
|
2
|
-
import { BuildCommandOptions } from '../types';
|
|
2
|
+
import type { BuildCommandOptions } from '../types';
|
|
3
3
|
import type { BuildTaskResult, BuildResult, BuildPlatformResult, WatchDtsHookContext, WatchJsHookContext, BaseBuildConfig } from '../types';
|
|
4
4
|
export declare const buildHooks: {
|
|
5
5
|
beforeBuild: import("@modern-js/plugin").ParallelWorkflow<{
|
package/dist/hooks/misc.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { CreateFilter } from '@rollup/pluginutils';
|
|
|
3
3
|
import type { MinifyOptions as TerserMinifyOptions } from 'terser';
|
|
4
4
|
import type { TestConfig } from '@modern-js/types';
|
|
5
5
|
import type { Config } from '../../../compiled/@svgr/core';
|
|
6
|
-
import { internalPreset, presetList } from '../../constants/preset';
|
|
7
|
-
import { ICompiler } from '../esbuild';
|
|
6
|
+
import type { internalPreset, presetList } from '../../constants/preset';
|
|
7
|
+
import type { ICompiler } from '../esbuild';
|
|
8
8
|
import type { ImportItem } from './transform-import';
|
|
9
9
|
import type { CopyConfig } from './copy';
|
|
10
10
|
import type { Dev } from './dev';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AcceptedPlugin as PostCSSPlugin, ProcessOptions, Plugin } from 'postcss';
|
|
2
2
|
import type { Options as sassOptions } from '../../../compiled/sass';
|
|
3
|
-
import Less from '../../../compiled/less';
|
|
3
|
+
import type Less from '../../../compiled/less';
|
|
4
4
|
type LocalsConventionFunction = (originalClassName: string, generatedClassName: string, inputFile: string) => string;
|
|
5
5
|
type GenerateScopedNameFunction = (name: string, filename: string, css: string) => string;
|
|
6
6
|
declare class Loader {
|
package/dist/types/esbuild.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { BuildContext, BuildOptions, OnLoadArgs, OnLoadResult, BuildResult, ImportKind } from 'esbuild';
|
|
3
3
|
import type { AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from 'tapable';
|
|
4
|
-
import { FSWatcher } from '@modern-js/utils';
|
|
5
|
-
import { BaseBuildConfig } from './config';
|
|
6
|
-
import { ModuleTools, PluginAPI } from '.';
|
|
4
|
+
import type { FSWatcher } from '@modern-js/utils';
|
|
5
|
+
import type { BaseBuildConfig } from './config';
|
|
6
|
+
import type { ModuleTools, PluginAPI } from '.';
|
|
7
7
|
export interface SourceMap {
|
|
8
8
|
mappings: string;
|
|
9
9
|
names: string[];
|
|
@@ -101,7 +101,7 @@ export type JsChunk = {
|
|
|
101
101
|
originalFileName?: string;
|
|
102
102
|
};
|
|
103
103
|
export type Chunk = AssetChunk | JsChunk;
|
|
104
|
-
export declare
|
|
104
|
+
export declare enum ChunkType {
|
|
105
105
|
chunk = "chunk",
|
|
106
106
|
asset = "asset"
|
|
107
107
|
}
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DevToolData as BaseDevToolData } from '@modern-js/core';
|
|
2
|
-
import { registerHook } from '../hooks';
|
|
1
|
+
import type { DevToolData as BaseDevToolData } from '@modern-js/core';
|
|
2
|
+
import type { registerHook } from '../hooks';
|
|
3
3
|
import type { BaseBuildConfig, BuildConfig, BuildType } from './config';
|
|
4
4
|
import type { DevCommandOptions, BuildCommandOptions } from './command';
|
|
5
5
|
export interface BuildTaskResult {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Externals, Minify, Platform } from '../config';
|
|
1
|
+
import type { Externals, Minify, Platform } from '../config';
|
|
2
2
|
export type LegacyBuildPreset = 'npm-library' | 'npm-library-with-umd' | 'npm-component' | 'npm-component-with-umd';
|
|
3
3
|
export type LegacyFormat = 'esm' | 'cjs' | 'umd';
|
|
4
4
|
export type LegacyTarget = 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'esnext';
|
package/dist/utils/dts.js
CHANGED
|
@@ -56,7 +56,7 @@ const getProjectTsconfig = async (tsconfigPath, resolutionContext = {}) => {
|
|
|
56
56
|
if (!tsConfig.extends) {
|
|
57
57
|
return tsConfig;
|
|
58
58
|
}
|
|
59
|
-
const extendsResolutionTarget = tsConfig.extends
|
|
59
|
+
const extendsResolutionTarget = Array.isArray(tsConfig.extends) ? tsConfig.extends : [
|
|
60
60
|
tsConfig.extends
|
|
61
61
|
];
|
|
62
62
|
const resolveParentTsConfigPromises = extendsResolutionTarget.map(async (target) => {
|
package/dist/utils/input.d.ts
CHANGED
package/dist/utils/print.d.ts
CHANGED
package/dist/utils/print.js
CHANGED
|
@@ -91,7 +91,7 @@ const prettyBytes = (bytes) => {
|
|
|
91
91
|
"YB"
|
|
92
92
|
];
|
|
93
93
|
const exp = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
94
|
-
return `${(bytes /
|
|
94
|
+
return `${(bytes / 1024 ** exp).toFixed(1)} ${unit[exp]}`;
|
|
95
95
|
};
|
|
96
96
|
const printBundleFiles = () => {
|
|
97
97
|
if (bundleFiles.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/module-tools",
|
|
3
|
-
"version": "2.58.
|
|
3
|
+
"version": "2.58.2",
|
|
4
4
|
"description": "Simple, powerful, high-performance modern npm package development solution.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modern",
|
|
@@ -70,22 +70,22 @@
|
|
|
70
70
|
"tapable": "2.2.1",
|
|
71
71
|
"terser": "^5.31.1",
|
|
72
72
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
73
|
-
"@modern-js/core": "2.58.
|
|
74
|
-
"@modern-js/plugin": "2.58.
|
|
75
|
-
"@modern-js/plugin
|
|
76
|
-
"@modern-js/plugin-i18n": "2.58.
|
|
77
|
-
"@modern-js/plugin-lint": "2.58.
|
|
78
|
-
"@modern-js/
|
|
79
|
-
"@modern-js/
|
|
73
|
+
"@modern-js/core": "2.58.2",
|
|
74
|
+
"@modern-js/plugin-changeset": "2.58.2",
|
|
75
|
+
"@modern-js/plugin": "2.58.2",
|
|
76
|
+
"@modern-js/plugin-i18n": "2.58.2",
|
|
77
|
+
"@modern-js/plugin-lint": "2.58.2",
|
|
78
|
+
"@modern-js/utils": "2.58.2",
|
|
79
|
+
"@modern-js/types": "2.58.2"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@rsbuild/core": "1.0.1-beta.
|
|
82
|
+
"@rsbuild/core": "1.0.1-beta.14",
|
|
83
83
|
"@types/convert-source-map": "1.5.2",
|
|
84
84
|
"@types/node": "^14",
|
|
85
85
|
"typescript": "^5",
|
|
86
|
-
"@modern-js/self": "npm:@modern-js/module-tools@2.58.
|
|
87
|
-
"@scripts/
|
|
88
|
-
"@scripts/
|
|
86
|
+
"@modern-js/self": "npm:@modern-js/module-tools@2.58.2",
|
|
87
|
+
"@scripts/vitest-config": "2.58.2",
|
|
88
|
+
"@scripts/build": "2.58.2"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"typescript": "^4 || ^5"
|
package/shims/cjs.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable node/prefer-global/url */
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
1
|
// taking from https://github.com/egoist/tsup/blob/dev/assets/cjs_shims.js
|
|
4
2
|
|
|
5
3
|
// Shim globals in cjs bundle
|
|
@@ -10,8 +8,7 @@
|
|
|
10
8
|
const getImportMetaUrl = () =>
|
|
11
9
|
typeof document === 'undefined'
|
|
12
10
|
? new URL(`file:${__filename}`).href
|
|
13
|
-
:
|
|
14
|
-
new URL('main.js', document.baseURI).href;
|
|
11
|
+
: document.currentScript?.src || new URL('main.js', document.baseURI).href;
|
|
15
12
|
|
|
16
13
|
// define importMetaUrl
|
|
17
14
|
export const importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|