fix: import path of types and runtime (#5981)

* fix: import path of types and runtime

* chore: package.json

* chore: add changelog

* fix: typings

* fix: type declare
This commit is contained in:
ClarkXia 2023-02-28 15:08:10 +08:00 committed by GitHub
parent 1c09e79e3f
commit 56fb406e8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
80 changed files with 297 additions and 245 deletions

View File

@ -0,0 +1,18 @@
---
'@ice/plugin-css-assets-local': patch
'@ice/plugin-moment-locales': patch
'@ice/plugin-rax-compat': patch
'@ice/plugin-icestark': patch
'@ice/plugin-jsx-plus': patch
'@ice/plugin-request': patch
'@ice/webpack-config': patch
'@ice/plugin-fusion': patch
'@ice/plugin-store': patch
'@ice/plugin-antd': patch
'@ice/plugin-auth': patch
'@ice/plugin-pha': patch
'@ice/runtime': patch
'@ice/app': patch
---
fix: support types definition without specify esm folder

View File

@ -1,5 +1,5 @@
import { defineAppConfig } from 'ice'; import { defineAppConfig } from 'ice';
import { defineAuthConfig } from '@ice/plugin-auth/esm/types'; import { defineAuthConfig } from '@ice/plugin-auth/types';
console.log('__LOG__'); console.log('__LOG__');
console.warn('__WARN__'); console.warn('__WARN__');

View File

@ -1,5 +1,5 @@
import { defineAppConfig } from 'ice'; import { defineAppConfig } from 'ice';
import { defineChildConfig } from '@ice/plugin-icestark/esm/types'; import { defineChildConfig } from '@ice/plugin-icestark/types';
export const icestark = defineChildConfig(() => { export const icestark = defineChildConfig(() => {
return { return {

View File

@ -1,5 +1,5 @@
import { defineAppConfig } from 'ice'; import { defineAppConfig } from 'ice';
import { defineFrameworkConfig } from '@ice/plugin-icestark/esm/types'; import { defineFrameworkConfig } from '@ice/plugin-icestark/types';
import FrameworkLayout from '@/components/FrameworkLayout'; import FrameworkLayout from '@/components/FrameworkLayout';
export const icestark = defineFrameworkConfig(() => ({ export const icestark = defineFrameworkConfig(() => ({

View File

@ -1,4 +1,4 @@
import type { ComponentWithChildren } from '@ice/runtime/esm/types'; import type { ComponentWithChildren } from '@ice/runtime/types';
import { useState } from 'react'; import { useState } from 'react';
import constate from 'constate'; import constate from 'constate';

View File

@ -1,5 +1,5 @@
import { defineAppConfig, defineDataLoader, Link } from 'ice'; import { defineAppConfig, defineDataLoader, Link } from 'ice';
import { defineAuthConfig } from '@ice/plugin-auth/esm/types'; import { defineAuthConfig } from '@ice/plugin-auth/types';
export default defineAppConfig(() => ({})); export default defineAppConfig(() => ({}));

View File

@ -1,4 +1,4 @@
import type { Manifest } from '@ice/plugin-pha/esm/types'; import type { Manifest } from '@ice/plugin-pha/types';
export const phaManifest: Manifest = { export const phaManifest: Manifest = {
title: 'test', title: 'test',

View File

@ -1,5 +1,5 @@
import { request as requestAPI, defineDataLoader } from 'ice'; import { request as requestAPI, defineDataLoader } from 'ice';
import { defineRequestConfig } from '@ice/plugin-request/esm/types'; import { defineRequestConfig } from '@ice/plugin-request/types';
export const dataLader = defineDataLoader(async () => { export const dataLader = defineDataLoader(async () => {
try { try {

View File

@ -1,5 +1,5 @@
import { defineAppConfig, defineDataLoader } from 'ice'; import { defineAppConfig, defineDataLoader } from 'ice';
import { defineStoreConfig } from '@ice/plugin-store/esm/types'; import { defineStoreConfig } from '@ice/plugin-store/types';
export const storeConfig = defineStoreConfig(async (appData) => { export const storeConfig = defineStoreConfig(async (appData) => {
return { return {

View File

@ -17,7 +17,7 @@
"!esm/**/*.map", "!esm/**/*.map",
"templates", "templates",
"openChrome.applescript", "openChrome.applescript",
"types.d.ts" "*.d.ts"
], ],
"engines": { "engines": {
"node": ">=14.19.0", "node": ">=14.19.0",

View File

@ -4,9 +4,9 @@ import { getWebpackConfig } from '@ice/webpack-config';
import type { Context, TaskConfig } from 'build-scripts'; import type { Context, TaskConfig } from 'build-scripts';
import webpack from '@ice/bundles/compiled/webpack/index.js'; import webpack from '@ice/bundles/compiled/webpack/index.js';
import type { StatsError, Stats } from 'webpack'; import type { StatsError, Stats } from 'webpack';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type ora from '@ice/bundles/compiled/ora/index.js'; import type ora from '@ice/bundles/compiled/ora/index.js';
import type { AppConfig } from '@ice/runtime/esm/types'; import type { AppConfig } from '@ice/runtime/types';
import type { RenderMode } from '@ice/runtime'; import type { RenderMode } from '@ice/runtime';
import type { ServerCompiler, GetAppConfig, GetRoutesConfig, ExtendsPluginAPI, GetDataloaderConfig } from '../types/plugin.js'; import type { ServerCompiler, GetAppConfig, GetRoutesConfig, ExtendsPluginAPI, GetDataloaderConfig } from '../types/plugin.js';
import webpackCompiler from '../service/webpackCompiler.js'; import webpackCompiler from '../service/webpackCompiler.js';

View File

@ -3,7 +3,7 @@ import detectPort from 'detect-port';
import type { Configuration as DevServerConfiguration } from 'webpack-dev-server'; import type { Configuration as DevServerConfiguration } from 'webpack-dev-server';
import type { Context, TaskConfig } from 'build-scripts'; import type { Context, TaskConfig } from 'build-scripts';
import type { StatsError, Compiler, Configuration } from 'webpack'; import type { StatsError, Compiler, Configuration } from 'webpack';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { AppConfig, RenderMode } from '@ice/runtime'; import type { AppConfig, RenderMode } from '@ice/runtime';
import type ora from '@ice/bundles/compiled/ora/index.js'; import type ora from '@ice/bundles/compiled/ora/index.js';
import WebpackDevServer from '@ice/bundles/compiled/webpack-dev-server/lib/Server.js'; import WebpackDevServer from '@ice/bundles/compiled/webpack-dev-server/lib/Server.js';

View File

@ -1,5 +1,5 @@
import type { Context, TaskConfig } from 'build-scripts'; import type { Context, TaskConfig } from 'build-scripts';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type ora from '@ice/bundles/compiled/ora/index.js'; import type ora from '@ice/bundles/compiled/ora/index.js';
function test( function test(

View File

@ -1,7 +1,7 @@
import { createRequire } from 'module'; import { createRequire } from 'module';
import trustCert from '@ice/bundles/compiled/trusted-cert/index.js'; import trustCert from '@ice/bundles/compiled/trusted-cert/index.js';
import fse from 'fs-extra'; import fse from 'fs-extra';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { UserConfigContext } from 'build-scripts'; import type { UserConfigContext } from 'build-scripts';
import lodash from '@ice/bundles/compiled/lodash/index.js'; import lodash from '@ice/bundles/compiled/lodash/index.js';
import type { UserConfig } from './types/userConfig.js'; import type { UserConfig } from './types/userConfig.js';

View File

@ -3,8 +3,8 @@ import { fileURLToPath } from 'url';
import { createRequire } from 'module'; import { createRequire } from 'module';
import { Context } from 'build-scripts'; import { Context } from 'build-scripts';
import type { CommandArgs, CommandName } from 'build-scripts'; import type { CommandArgs, CommandName } from 'build-scripts';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { AppConfig } from '@ice/runtime/esm/types'; import type { AppConfig } from '@ice/runtime/types';
import webpack from '@ice/bundles/compiled/webpack/index.js'; import webpack from '@ice/bundles/compiled/webpack/index.js';
import fg from 'fast-glob'; import fg from 'fast-glob';
import type { DeclarationData, PluginData, ExtendsPluginAPI, TargetDeclarationData } from './types'; import type { DeclarationData, PluginData, ExtendsPluginAPI, TargetDeclarationData } from './types';

View File

@ -2,7 +2,7 @@ import * as path from 'path';
import * as mrmime from 'mrmime'; import * as mrmime from 'mrmime';
import fs from 'fs-extra'; import fs from 'fs-extra';
import type { PluginBuild } from 'esbuild'; import type { PluginBuild } from 'esbuild';
import type { AssetsManifest } from '@ice/runtime/esm/types'; import type { AssetsManifest } from '@ice/runtime/types';
export const ASSET_TYPES = [ export const ASSET_TYPES = [
// images // images

View File

@ -1,6 +1,6 @@
import * as path from 'path'; import * as path from 'path';
import type { Context } from 'build-scripts'; import type { Context } from 'build-scripts';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { WatchEvent } from './types/plugin.js'; import type { WatchEvent } from './types/plugin.js';
import { generateRoutesInfo, getRoutesDefination } from './routes.js'; import { generateRoutesInfo, getRoutesDefination } from './routes.js';
import type Generator from './service/runtimeGenerator'; import type Generator from './service/runtimeGenerator';

View File

@ -4,7 +4,7 @@ import type { ServerContext, RenderMode } from '@ice/runtime';
// @ts-expect-error FIXME: esm type error // @ts-expect-error FIXME: esm type error
import matchRoutes from '@ice/runtime/matchRoutes'; import matchRoutes from '@ice/runtime/matchRoutes';
import type { TaskConfig } from 'build-scripts'; import type { TaskConfig } from 'build-scripts';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { ExtendsPluginAPI } from '../../types/plugin.js'; import type { ExtendsPluginAPI } from '../../types/plugin.js';
import getRouterBasename from '../../utils/getRouterBasename.js'; import getRouterBasename from '../../utils/getRouterBasename.js';
import dynamicImport from '../../utils/dynamicImport.js'; import dynamicImport from '../../utils/dynamicImport.js';

View File

@ -3,7 +3,7 @@ import type { ServerContext, RenderMode } from '@ice/runtime';
// @ts-expect-error FIXME: esm type error // @ts-expect-error FIXME: esm type error
import matchRoutes from '@ice/runtime/matchRoutes'; import matchRoutes from '@ice/runtime/matchRoutes';
import type { TaskConfig } from 'build-scripts'; import type { TaskConfig } from 'build-scripts';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import getRouterBasename from '../../utils/getRouterBasename.js'; import getRouterBasename from '../../utils/getRouterBasename.js';
import warnOnHashRouterEnabled from '../../utils/warnOnHashRouterEnabled.js'; import warnOnHashRouterEnabled from '../../utils/warnOnHashRouterEnabled.js';
import type { UserConfig } from '../../types/userConfig.js'; import type { UserConfig } from '../../types/userConfig.js';

View File

@ -1,6 +1,6 @@
import * as path from 'path'; import * as path from 'path';
import { createRequire } from 'module'; import { createRequire } from 'module';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import { CACHE_DIR, RUNTIME_TMP_DIR } from '../../constant.js'; import { CACHE_DIR, RUNTIME_TMP_DIR } from '../../constant.js';
import { getRoutePathsFromCache } from '../../utils/getRoutePaths.js'; import { getRoutePathsFromCache } from '../../utils/getRoutePaths.js';

View File

@ -5,7 +5,7 @@ import { getCompilerPlugins, getCSSModuleLocalIdent } from '@ice/webpack-config'
import moduleLexer from '@ice/bundles/compiled/es-module-lexer/index.js'; import moduleLexer from '@ice/bundles/compiled/es-module-lexer/index.js';
import MagicString from '@ice/bundles/compiled/magic-string/index.js'; import MagicString from '@ice/bundles/compiled/magic-string/index.js';
import type { TaskConfig } from 'build-scripts'; import type { TaskConfig } from 'build-scripts';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { PluginBuild, OnResolveOptions, Plugin, OnLoadResult, OnResolveResult } from 'esbuild'; import type { PluginBuild, OnResolveOptions, Plugin, OnLoadResult, OnResolveResult } from 'esbuild';
import emptyCSSPlugin from '../esbuild/emptyCSS.js'; import emptyCSSPlugin from '../esbuild/emptyCSS.js';
import ignorePlugin from '../esbuild/ignore.js'; import ignorePlugin from '../esbuild/ignore.js';

View File

@ -5,7 +5,7 @@ import { esbuild } from '@ice/bundles';
import type { Plugin, BuildOptions } from 'esbuild'; import type { Plugin, BuildOptions } from 'esbuild';
import { resolve as resolveExports, legacy as resolveLegacy } from 'resolve.exports'; import { resolve as resolveExports, legacy as resolveLegacy } from 'resolve.exports';
import moduleLexer from '@ice/bundles/compiled/es-module-lexer/index.js'; import moduleLexer from '@ice/bundles/compiled/es-module-lexer/index.js';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { TaskConfig } from 'build-scripts'; import type { TaskConfig } from 'build-scripts';
import { getCSSModuleLocalIdent } from '@ice/webpack-config'; import { getCSSModuleLocalIdent } from '@ice/webpack-config';
import flattenId from '../utils/flattenId.js'; import flattenId from '../utils/flattenId.js';

View File

@ -90,10 +90,11 @@ export function generateDeclaration(exportList: Array<TargetDeclarationData | De
specifiers.forEach((specifierStr) => { specifiers.forEach((specifierStr) => {
if (alias && alias[specifierStr]) { if (alias && alias[specifierStr]) {
exportDeclarations.push(`${alias[specifierStr]}: ${specifierStr}${symbol}`); exportDeclarations.push(`${alias[specifierStr]}: ${specifierStr}${symbol}`);
exportNames.push(alias[specifierStr]);
} else { } else {
exportDeclarations.push(`${specifierStr}${symbol}`); exportDeclarations.push(`${specifierStr}${symbol}`);
}
exportNames.push(specifierStr); exportNames.push(specifierStr);
}
}); });
} }
}); });

View File

@ -2,7 +2,7 @@ import * as path from 'path';
import { esbuild } from '@ice/bundles'; import { esbuild } from '@ice/bundles';
import fse from 'fs-extra'; import fse from 'fs-extra';
import fg from 'fast-glob'; import fg from 'fast-glob';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import lodash from '@ice/bundles/compiled/lodash/index.js'; import lodash from '@ice/bundles/compiled/lodash/index.js';
import type { TaskConfig } from 'build-scripts'; import type { TaskConfig } from 'build-scripts';
import { getCompilerPlugins, getCSSModuleLocalIdent } from '@ice/webpack-config'; import { getCompilerPlugins, getCSSModuleLocalIdent } from '@ice/webpack-config';

View File

@ -2,7 +2,7 @@ import webpackBundler from '@ice/bundles/compiled/webpack/index.js';
import type ora from '@ice/bundles/compiled/ora/index.js'; import type ora from '@ice/bundles/compiled/ora/index.js';
import lodash from '@ice/bundles/compiled/lodash/index.js'; import lodash from '@ice/bundles/compiled/lodash/index.js';
import type { TaskConfig, Context } from 'build-scripts'; import type { TaskConfig, Context } from 'build-scripts';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type webpack from 'webpack'; import type webpack from 'webpack';
import type { Urls, ServerCompiler, GetAppConfig, GetRoutesConfig, ExtendsPluginAPI, GetDataloaderConfig } from '../types/plugin.js'; import type { Urls, ServerCompiler, GetAppConfig, GetRoutesConfig, ExtendsPluginAPI, GetDataloaderConfig } from '../types/plugin.js';
import formatWebpackMessages from '../utils/formatWebpackMessages.js'; import formatWebpackMessages from '../utils/formatWebpackMessages.js';

View File

@ -1,7 +1,7 @@
import * as path from 'path'; import * as path from 'path';
import type { Config as JestConfig } from 'jest'; import type { Config as JestConfig } from 'jest';
import fse from 'fs-extra'; import fse from 'fs-extra';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import lodash from '@ice/bundles/compiled/lodash/index.js'; import lodash from '@ice/bundles/compiled/lodash/index.js';
import getTaskConfig from './getTaskConfig.js'; import getTaskConfig from './getTaskConfig.js';

View File

@ -2,4 +2,4 @@ export * from './generator.js';
export * from './plugin.js'; export * from './plugin.js';
export * from './userConfig.js'; export * from './userConfig.js';
// Export type webpack for same instance of webpack. // Export type webpack for same instance of webpack.
export type { Config, webpack } from '@ice/webpack-config/esm/types'; export type { Config, webpack } from '@ice/webpack-config/types';

View File

@ -3,8 +3,8 @@ import type { _Plugin, CommandArgs, TaskConfig } from 'build-scripts';
import type { Configuration, Stats, WebpackOptionsNormalized } from '@ice/bundles/compiled/webpack'; import type { Configuration, Stats, WebpackOptionsNormalized } from '@ice/bundles/compiled/webpack';
import type { esbuild } from '@ice/bundles'; import type { esbuild } from '@ice/bundles';
import type { NestedRouteManifest } from '@ice/route-manifest'; import type { NestedRouteManifest } from '@ice/route-manifest';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { AppConfig, AssetsManifest } from '@ice/runtime/esm/types'; import type { AppConfig, AssetsManifest } from '@ice/runtime/types';
import type ServerCompileTask from '../utils/ServerCompileTask.js'; import type ServerCompileTask from '../utils/ServerCompileTask.js';
import type { DeclarationData, TargetDeclarationData, AddRenderFile, AddTemplateFiles, ModifyRenderData, AddDataLoaderImport, Render } from './generator.js'; import type { DeclarationData, TargetDeclarationData, AddRenderFile, AddTemplateFiles, ModifyRenderData, AddDataLoaderImport, Render } from './generator.js';

View File

@ -2,7 +2,7 @@ import type { DefineRouteFunction, RouteItem } from '@ice/route-manifest';
import type { PluginList } from 'build-scripts'; import type { PluginList } from 'build-scripts';
import type { UnpluginOptions } from '@ice/bundles/compiled/unplugin/index.js'; import type { UnpluginOptions } from '@ice/bundles/compiled/unplugin/index.js';
import type { ProcessOptions } from '@ice/bundles'; import type { ProcessOptions } from '@ice/bundles';
import type { Config, ModifyWebpackConfig, MinimizerOptions } from '@ice/webpack-config/esm/types'; import type { Config, ModifyWebpackConfig, MinimizerOptions } from '@ice/webpack-config/types';
import type { OverwritePluginAPI } from './plugin'; import type { OverwritePluginAPI } from './plugin';
interface SyntaxFeatures { interface SyntaxFeatures {

View File

@ -1,5 +1,5 @@
import type { AppConfig } from '@ice/runtime'; import type { AppConfig } from '@ice/runtime';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import type { TaskConfig } from 'build-scripts'; import type { TaskConfig } from 'build-scripts';
const getRouterBasename = (taskConfig: TaskConfig<Config>, appConfig: AppConfig) => { const getRouterBasename = (taskConfig: TaskConfig<Config>, appConfig: AppConfig) => {

View File

@ -1,5 +1,5 @@
import type { TaskConfig } from 'build-scripts'; import type { TaskConfig } from 'build-scripts';
import type { Config } from '@ice/webpack-config/esm/types'; import type { Config } from '@ice/webpack-config/types';
import lodash from '@ice/bundles/compiled/lodash/index.js'; import lodash from '@ice/bundles/compiled/lodash/index.js';
const { mergeWith } = lodash; const { mergeWith } = lodash;

View File

@ -3,7 +3,7 @@ import * as fs from 'fs';
import * as dotenv from 'dotenv'; import * as dotenv from 'dotenv';
import { expand as dotenvExpand } from 'dotenv-expand'; import { expand as dotenvExpand } from 'dotenv-expand';
import type { CommandArgs } from 'build-scripts'; import type { CommandArgs } from 'build-scripts';
import type { AppConfig } from '@ice/runtime/esm/types'; import type { AppConfig } from '@ice/runtime/types';
export interface Envs { export interface Envs {
[key: string]: string; [key: string]: string;

View File

@ -1,5 +1,5 @@
import type { AppConfig, RouteConfig as DefaultRouteConfig } from '@ice/runtime';
<%- routeConfigTypes.imports -%> <%- routeConfigTypes.imports -%>
import type { AppConfig, RouteConfig as DefaultRouteConfig } from '@ice/runtime';
<% if (routeConfigTypes.imports) {-%> <% if (routeConfigTypes.imports) {-%>
type ExtendsRouteConfig = <% if (routeConfigTypes.imports) { %><%- routeConfigTypes.exportNames.join(' & ') %><% } %>; type ExtendsRouteConfig = <% if (routeConfigTypes.imports) { %><%- routeConfigTypes.exportNames.join(' & ') %><% } %>;
@ -15,4 +15,5 @@ type PageConfigDefinition = (context: PageConfigDefinitionContext) => PageConfig
export type { export type {
AppConfig, AppConfig,
PageConfig, PageConfig,
PageConfigDefinition,
}; };

View File

@ -1,3 +1,4 @@
declare global {
// CSS modules // CSS modules
declare module '*.module.less' { declare module '*.module.less' {
const classes: { [key: string]: string }; const classes: { [key: string]: string };
@ -145,7 +146,7 @@ declare namespace NodeJS {
ICE_CORE_ROUTER: 'true' | 'false'; ICE_CORE_ROUTER: 'true' | 'false';
ICE_CORE_ERROR_BOUNDARY: 'true' | 'false'; ICE_CORE_ERROR_BOUNDARY: 'true' | 'false';
ICE_CORE_INITIAL_DATA: 'true' | 'false'; ICE_CORE_INITIAL_DATA: 'true' | 'false';
ICE_CORE_DEV_PORT: number; ICE_CORE_DEV_PORT: string;
} }
} }
@ -160,3 +161,6 @@ interface ImportMeta {
// ice.js defined env variables // ice.js defined env variables
env: Record<string, string>; env: Record<string, string>;
} }
}
export * from './esm/types';

1
packages/ice/typings.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/types';

View File

@ -1,5 +1,5 @@
import { createRequire } from 'module'; import { createRequire } from 'module';
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
import styleImportPlugin from '@ice/style-import'; import styleImportPlugin from '@ice/style-import';
interface PluginOptions { interface PluginOptions {

View File

@ -35,7 +35,8 @@
"types": "./esm/index.d.ts", "types": "./esm/index.d.ts",
"files": [ "files": [
"esm", "esm",
"!esm/**/*.map" "!esm/**/*.map",
"*.d.ts"
], ],
"devDependencies": { "devDependencies": {
"@ice/app": "^3.1.1-beta.9", "@ice/app": "^3.1.1-beta.9",

1
packages/plugin-auth/runtime.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/runtime';

View File

@ -1,4 +1,4 @@
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
const PLUGIN_NAME = '@ice/plugin-auth'; const PLUGIN_NAME = '@ice/plugin-auth';
@ -8,16 +8,16 @@ const plugin: Plugin = () => ({
// Register API: `import { useAuth, withAuth } from 'ice';` // Register API: `import { useAuth, withAuth } from 'ice';`
generator.addExport({ generator.addExport({
specifier: ['withAuth', 'useAuth'], specifier: ['withAuth', 'useAuth'],
source: '@ice/plugin-auth/esm/runtime', source: '@ice/plugin-auth/runtime',
}); });
generator.addRouteTypes({ generator.addRouteTypes({
specifier: ['ConfigAuth'], specifier: ['ConfigAuth'],
type: true, type: true,
source: '@ice/plugin-auth/esm/types', source: '@ice/plugin-auth/types',
}); });
}, },
runtime: `${PLUGIN_NAME}/esm/runtime`, runtime: `${PLUGIN_NAME}/runtime`,
}); });
export default plugin; export default plugin;

View File

@ -1,5 +1,5 @@
import * as React from 'react'; import * as React from 'react';
import type { RuntimePlugin, AppProvider, RouteWrapper } from '@ice/runtime/esm/types'; import type { RuntimePlugin, AppProvider, RouteWrapper } from '@ice/runtime/types';
import type { AuthConfig, AuthType, Auth } from '../types.js'; import type { AuthConfig, AuthType, Auth } from '../types.js';
import { AuthProvider, useAuth, withAuth } from './Auth.js'; import { AuthProvider, useAuth, withAuth } from './Auth.js';
import type { InjectProps } from './Auth.js'; import type { InjectProps } from './Auth.js';

View File

@ -1,5 +1,5 @@
import type * as React from 'react'; import type * as React from 'react';
import type { RouteConfig } from '@ice/runtime/esm/types'; import type { RouteConfig } from '@ice/runtime/types';
export interface AuthConfig { export interface AuthConfig {
initialAuth: { initialAuth: {

1
packages/plugin-auth/types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/types';

View File

@ -1,4 +1,4 @@
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
// @ts-expect-error cjs module error // @ts-expect-error cjs module error
import ExtractCssAssetsWebpackPlugin from 'extract-css-assets-webpack-plugin'; import ExtractCssAssetsWebpackPlugin from 'extract-css-assets-webpack-plugin';
import consola from 'consola'; import consola from 'consola';

View File

@ -1,5 +1,5 @@
import { createRequire } from 'module'; import { createRequire } from 'module';
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
import styleImportPlugin from '@ice/style-import'; import styleImportPlugin from '@ice/style-import';
interface PluginOptions { interface PluginOptions {

View File

@ -9,7 +9,8 @@
"type": "module", "type": "module",
"files": [ "files": [
"esm", "esm",
"!esm/**/*.map" "!esm/**/*.map",
"*.d.ts"
], ],
"exports": { "exports": {
".": { ".": {
@ -27,6 +28,11 @@
"import": "./esm/runtime/framework.js", "import": "./esm/runtime/framework.js",
"default": "./esm/runtime/framework.js" "default": "./esm/runtime/framework.js"
}, },
"./types": {
"types": "./esm/types.d.ts",
"import": "./esm/types.js",
"default": "./esm/types.js"
},
"./esm/types": { "./esm/types": {
"types": "./esm/types.d.ts", "types": "./esm/types.d.ts",
"import": "./esm/types.js", "import": "./esm/types.js",

2
packages/plugin-icestark/runtime.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export * from './esm/runtime/child';
export * from './esm/runtime/framework';

View File

@ -1,4 +1,4 @@
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
interface PluginOptions { interface PluginOptions {
type: 'child' | 'framework'; type: 'child' | 'framework';

View File

@ -1,5 +1,5 @@
import * as ReactDOM from 'react-dom/client'; import * as ReactDOM from 'react-dom/client';
import type { RuntimePlugin } from '@ice/runtime/esm/types'; import type { RuntimePlugin } from '@ice/runtime/types';
import type { LifecycleOptions } from '../types'; import type { LifecycleOptions } from '../types';
const runtime: RuntimePlugin<LifecycleOptions> = ({ setRender }, runtimeOptions) => { const runtime: RuntimePlugin<LifecycleOptions> = ({ setRender }, runtimeOptions) => {

View File

@ -1,6 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import { AppRouter, AppRoute } from '@ice/stark'; import { AppRouter, AppRoute } from '@ice/stark';
import type { RuntimePlugin, AppRouterProps } from '@ice/runtime/esm/types'; import type { RuntimePlugin, AppRouterProps } from '@ice/runtime/types';
import type { RouteInfo, AppConfig } from '../types'; import type { RouteInfo, AppConfig } from '../types';
const { useState, useEffect } = React; const { useState, useEffect } = React;

1
packages/plugin-icestark/types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/types';

View File

@ -1,6 +1,6 @@
import path from 'path'; import path from 'path';
import { createRequire } from 'module'; import { createRequire } from 'module';
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
import { transformSync } from '@babel/core'; import { transformSync } from '@babel/core';
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);

View File

@ -1,4 +1,4 @@
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
interface PluginOptions { interface PluginOptions {
locales: string | string[]; locales: string | string[];

View File

@ -9,7 +9,8 @@
"files": [ "files": [
"esm", "esm",
"!esm/**/*.map", "!esm/**/*.map",
"template" "template",
"*.d.ts"
], ],
"scripts": { "scripts": {
"watch": "tsc -w", "watch": "tsc -w",

1
packages/plugin-pha/runtime.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/runtime';

View File

@ -1,4 +1,4 @@
import type { PluginData } from '@ice/app/esm/types'; import type { PluginData } from '@ice/app/types';
import type { Context } from 'build-scripts'; import type { Context } from 'build-scripts';
// Keys of appConfig need transform to manifest. // Keys of appConfig need transform to manifest.

View File

@ -1,6 +1,6 @@
import * as path from 'path'; import * as path from 'path';
import * as fs from 'fs'; import * as fs from 'fs';
import type { GetAppConfig, GetDataloaderConfig, GetRoutesConfig, ServerCompiler } from '@ice/app/esm/types'; import type { GetAppConfig, GetDataloaderConfig, GetRoutesConfig, ServerCompiler } from '@ice/app/types';
import type { Context } from 'build-scripts'; import type { Context } from 'build-scripts';
import { parseManifest, rewriteAppWorker, getAppWorkerUrl, getMultipleManifest, type ParseOptions } from './manifestHelpers.js'; import { parseManifest, rewriteAppWorker, getAppWorkerUrl, getMultipleManifest, type ParseOptions } from './manifestHelpers.js';
import { getCompilerConfig } from './constants.js'; import { getCompilerConfig } from './constants.js';

View File

@ -2,7 +2,7 @@ import * as path from 'path';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import consola from 'consola'; import consola from 'consola';
import chalk from 'chalk'; import chalk from 'chalk';
import type { Plugin, GetAppConfig, GetRoutesConfig, GetDataloaderConfig, ServerCompiler } from '@ice/app/esm/types'; import type { Plugin, GetAppConfig, GetRoutesConfig, GetDataloaderConfig, ServerCompiler } from '@ice/app/types';
import generateManifest, { getAppWorkerPath } from './generateManifest.js'; import generateManifest, { getAppWorkerPath } from './generateManifest.js';
import createPHAMiddleware from './phaMiddleware.js'; import createPHAMiddleware from './phaMiddleware.js';
@ -42,8 +42,9 @@ const plugin: Plugin<PluginOptions> = (options) => ({
generator.addRouteTypes({ generator.addRouteTypes({
specifier: ['PageConfig'], specifier: ['PageConfig'],
alias: { PageConfig: 'PHAPageConfig' },
type: true, type: true,
source: '@ice/plugin-pha/esm/types', source: '@ice/plugin-pha/types',
}); });
// TODO: get route manifest by API. // TODO: get route manifest by API.

1
packages/plugin-pha/types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/types';

View File

@ -1,6 +1,6 @@
import fs from 'fs'; import fs from 'fs';
import { createRequire } from 'module'; import { createRequire } from 'module';
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
import type { RuleSetRule } from 'webpack'; import type { RuleSetRule } from 'webpack';
import consola from 'consola'; import consola from 'consola';
import merge from 'lodash.merge'; import merge from 'lodash.merge';

View File

@ -45,7 +45,8 @@
"types": "./esm/index.d.ts", "types": "./esm/index.d.ts",
"files": [ "files": [
"esm", "esm",
"!esm/**/*.map" "!esm/**/*.map",
"*.d.ts"
], ],
"dependencies": { "dependencies": {
"ahooks": "^3.0.0", "ahooks": "^3.0.0",

1
packages/plugin-request/runtime.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/runtime';

View File

@ -1,4 +1,4 @@
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
import type { Request, Interceptors, InterceptorRequest, InterceptorResponse } from './types'; import type { Request, Interceptors, InterceptorRequest, InterceptorResponse } from './types';
// @ts-ignore // @ts-ignore
@ -24,7 +24,7 @@ const plugin: Plugin<PluginRequestOptions | void> = () => ({
type: false, type: false,
}); });
}, },
runtime: `${PLUGIN_NAME}/esm/runtime`, runtime: `${PLUGIN_NAME}/runtime`,
staticRuntime: true, staticRuntime: true,
keepExports: ['requestConfig'], keepExports: ['requestConfig'],
}); });

View File

@ -1,4 +1,4 @@
import type { StaticRuntimePlugin } from '@ice/runtime/esm/types'; import type { StaticRuntimePlugin } from '@ice/runtime/types';
import { createAxiosInstance, setAxiosInstance } from './request.js'; import { createAxiosInstance, setAxiosInstance } from './request.js';
import type { RequestConfig } from './types'; import type { RequestConfig } from './types';

1
packages/plugin-request/types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/types';

View File

@ -35,7 +35,8 @@
"types": "./esm/index.d.ts", "types": "./esm/index.d.ts",
"files": [ "files": [
"esm", "esm",
"!esm/**/*.map" "!esm/**/*.map",
"*.d.ts"
], ],
"dependencies": { "dependencies": {
"@ice/store": "^2.0.3", "@ice/store": "^2.0.3",

1
packages/plugin-store/runtime.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/runtime';

View File

@ -1,5 +1,5 @@
import * as path from 'path'; import * as path from 'path';
import type { Config, Plugin } from '@ice/app/esm/types'; import type { Config, Plugin } from '@ice/app/types';
import micromatch from 'micromatch'; import micromatch from 'micromatch';
import fg from 'fast-glob'; import fg from 'fast-glob';
import { PAGE_STORE_MODULE, PAGE_STORE_PROVIDER, PAGE_STORE_INITIAL_STATES } from './constants.js'; import { PAGE_STORE_MODULE, PAGE_STORE_PROVIDER, PAGE_STORE_INITIAL_STATES } from './constants.js';
@ -60,11 +60,11 @@ const plugin: Plugin<Options> = (options) => ({
// Export store api: createStore, createModel from `.ice/index.ts`. // Export store api: createStore, createModel from `.ice/index.ts`.
generator.addExport({ generator.addExport({
specifier: ['createStore', 'createModel'], specifier: ['createStore', 'createModel'],
source: '@ice/plugin-store/esm/runtime', source: '@ice/plugin-store/runtime',
type: false, type: false,
}); });
}, },
runtime: `${PLUGIN_NAME}/esm/runtime`, runtime: `${PLUGIN_NAME}/runtime`,
}); });
const formatId = (id: string) => id.split(path.sep).join('/'); const formatId = (id: string) => id.split(path.sep).join('/');
function exportStoreProviderPlugin({ pageDir, resetPageState }: { pageDir: string; resetPageState: boolean }): Config['transformPlugins'][0] { function exportStoreProviderPlugin({ pageDir, resetPageState }: { pageDir: string; resetPageState: boolean }): Config['transformPlugins'][0] {

View File

@ -1,5 +1,5 @@
import * as React from 'react'; import * as React from 'react';
import type { RuntimePlugin, AppProvider, RouteWrapper } from '@ice/runtime/esm/types'; import type { RuntimePlugin, AppProvider, RouteWrapper } from '@ice/runtime/types';
import { PAGE_STORE_INITIAL_STATES, PAGE_STORE_PROVIDER } from './constants.js'; import { PAGE_STORE_INITIAL_STATES, PAGE_STORE_PROVIDER } from './constants.js';
import type { StoreConfig } from './types.js'; import type { StoreConfig } from './types.js';

1
packages/plugin-store/types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/types';

View File

@ -20,7 +20,8 @@
"files": [ "files": [
"esm", "esm",
"!esm/**/*.map", "!esm/**/*.map",
"templates" "templates",
"*.d.ts"
], ],
"author": "ICE", "author": "ICE",
"license": "MIT", "license": "MIT",

1
packages/runtime/router.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/router';

1
packages/runtime/types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/types';

View File

@ -12,7 +12,8 @@
}, },
"files": [ "files": [
"esm", "esm",
"!esm/**/*.map" "!esm/**/*.map",
"*.d.ts"
], ],
"dependencies": { "dependencies": {
"@ice/bundles": "0.1.4", "@ice/bundles": "0.1.4",

1
packages/webpack-config/types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './esm/types';

View File

@ -53,7 +53,7 @@ export default defineConfig(() => ({
大多数情况下权限管理通常需要从服务端获取权限数据,然后在前端通过权限对比以此控制页面、操作等等权限行为。约定在 `src/app.ts` 中导出 `auth` 对象,该对象包含从服务端异步获取初始化的权限数据,并且约定最终返回格式为 `{ initialAuth: { [key: string]: boolean } }` 大多数情况下权限管理通常需要从服务端获取权限数据,然后在前端通过权限对比以此控制页面、操作等等权限行为。约定在 `src/app.ts` 中导出 `auth` 对象,该对象包含从服务端异步获取初始化的权限数据,并且约定最终返回格式为 `{ initialAuth: { [key: string]: boolean } }`
```ts title="src/app.ts" ```ts title="src/app.ts"
import { defineAuthConfig } from '@ice/plugin-auth/esm/types'; import { defineAuthConfig } from '@ice/plugin-auth/types';
export const authConfig = defineAuthConfig(async () => { export const authConfig = defineAuthConfig(async () => {
// 模拟请求权限数据 // 模拟请求权限数据
@ -196,7 +196,7 @@ function Foo() {
支持自定义无权限时的展示组件,默认为 `<>No Auth</>` 支持自定义无权限时的展示组件,默认为 `<>No Auth</>`
```diff title="src/app.tsx" ```diff title="src/app.tsx"
import { defineAuthConfig } from '@ice/plugin-auth/esm/types'; import { defineAuthConfig } from '@ice/plugin-auth/types';
export const authConfig = defineAuthConfig(async () => { export const authConfig = defineAuthConfig(async () => {
return { return {

View File

@ -58,7 +58,7 @@ export default defineConfig(() => ({
应用入口配置微应用相关信息: 应用入口配置微应用相关信息:
```ts title="src/app.ts" ```ts title="src/app.ts"
import { defineFrameworkConfig } from '@ice/plugin-icestark/esm/types'; import { defineFrameworkConfig } from '@ice/plugin-icestark/types';
import FrameworkLayout from '@/components/FrameworkLayout'; import FrameworkLayout from '@/components/FrameworkLayout';
export const icestark = defineFrameworkConfig(() => ({ export const icestark = defineFrameworkConfig(() => ({
@ -98,7 +98,7 @@ export default defineConfig(() => ({
应用入口可以配置相关生命周期执行行为(可选): 应用入口可以配置相关生命周期执行行为(可选):
```ts title="ice.config.mts" ```ts title="ice.config.mts"
import { defineChildConfig } from '@ice/plugin-icestark/esm/types'; import { defineChildConfig } from '@ice/plugin-icestark/types';
export const icestark = defineChildConfig(() => ({ export const icestark = defineChildConfig(() => ({
mount: () => { mount: () => {
@ -144,7 +144,7 @@ export default function FrameworkLayout({ children }) {
```ts title="src/app.ts" ```ts title="src/app.ts"
import { defineFrameworkConfig } from '@ice/plugin-icestark/esm/types'; import { defineFrameworkConfig } from '@ice/plugin-icestark/types';
import FrameworkLayout from '@/components/FrameworkLayout'; import FrameworkLayout from '@/components/FrameworkLayout';
export const icestark = defineFrameworkConfig(() => ({ export const icestark = defineFrameworkConfig(() => ({

View File

@ -365,7 +365,7 @@ const { data, error, loading, request } = useRequest((id) => ({
在实际项目中通常需要对请求进行全局统一的封装,例如配置请求的 baseURL、统一 header、拦截请求和响应等等这时只需要在应用的的 appConfig 中进行配置即可。 在实际项目中通常需要对请求进行全局统一的封装,例如配置请求的 baseURL、统一 header、拦截请求和响应等等这时只需要在应用的的 appConfig 中进行配置即可。
```ts title="src/app.tsx" ```ts title="src/app.tsx"
import { defineRequestConfig } from '@ice/plugin-request/esm/types'; import { defineRequestConfig } from '@ice/plugin-request/types';
export const requestConfig = defineRequestConfig({ export const requestConfig = defineRequestConfig({
// 可选的,全局设置 request 是否返回 response 对象,默认为 false // 可选的,全局设置 request 是否返回 response 对象,默认为 false
@ -412,7 +412,7 @@ export const requestConfig = defineRequestConfig({
在某些复杂场景的应用中,我们也可以配置多个请求,每个配置请求都是单一的实例对象。 在某些复杂场景的应用中,我们也可以配置多个请求,每个配置请求都是单一的实例对象。
```ts title="src/app.tsx" ```ts title="src/app.tsx"
import { defineRequestConfig } from '@ice/plugin-request/esm/types'; import { defineRequestConfig } from '@ice/plugin-request/types';
export const requestConfig = defineRequestConfig([ export const requestConfig = defineRequestConfig([
{ {
@ -492,7 +492,7 @@ const error = {
大部分情况下,前端代码里用到的后端接口写的都是相对路径如 `/api/getFoo.json`,然后访问不同环境时浏览器会根据当前域名发起对应的请求。如果域名跟实际请求的接口地址不一致,则需要通过 `request.baseURL` 来配置: 大部分情况下,前端代码里用到的后端接口写的都是相对路径如 `/api/getFoo.json`,然后访问不同环境时浏览器会根据当前域名发起对应的请求。如果域名跟实际请求的接口地址不一致,则需要通过 `request.baseURL` 来配置:
```ts title="src/app.tsx" ```ts title="src/app.tsx"
import { defineRequestConfig } from '@ice/plugin-request/esm/types'; import { defineRequestConfig } from '@ice/plugin-request/types';
export const requestConfig = defineRequestConfig({ export const requestConfig = defineRequestConfig({
baseURL: '//service.example.com/api', baseURL: '//service.example.com/api',
@ -513,7 +513,7 @@ BASEURL=https://example.com/api
`src/app.tsx` 中配置 `request.baseURL`: `src/app.tsx` 中配置 `request.baseURL`:
```ts title="src/app.tsx" ```ts title="src/app.tsx"
import { defineRequestConfig } from '@ice/plugin-request/esm/types'; import { defineRequestConfig } from '@ice/plugin-request/types';
export const requestConfig = defineRequestConfig({ export const requestConfig = defineRequestConfig({
baseURL: process.env.BASEURL, baseURL: process.env.BASEURL,

View File

@ -251,7 +251,7 @@ export default createModel({
我们可以在 `src/app.ts` 中设置两个 Model 初始状态: 我们可以在 `src/app.ts` 中设置两个 Model 初始状态:
```ts title="src/app.ts" ```ts title="src/app.ts"
import { defineStoreConfig } from '@ice/plugin-store/esm/types'; import { defineStoreConfig } from '@ice/plugin-store/types';
export const storeConfig = defineStoreConfig(async () => { export const storeConfig = defineStoreConfig(async () => {
// 模拟请求后端数据 // 模拟请求后端数据

View File

@ -103,7 +103,7 @@ export default defineAppConfig(() => ({
```js ```js
import { defineAppConfig } from 'ice'; import { defineAppConfig } from 'ice';
import { defineAuthConfig } from '@ice/plugin-auth/esm/types'; import { defineAuthConfig } from '@ice/plugin-auth/types';
// 导出 auth 相关的能力,该能力由 @ice/plugin-auth 插件提供 // 导出 auth 相关的能力,该能力由 @ice/plugin-auth 插件提供
export const authConfig = defineAuthConfig(() => { export const authConfig = defineAuthConfig(() => {

View File

@ -17,7 +17,7 @@ ice.js 提供了插件机制,在提供丰富的框架能力的基础上也可
ice.js 插件本质是一个 JS 模块,官方推荐以 TS 进行开发以获得良好的类型提示: ice.js 插件本质是一个 JS 模块,官方推荐以 TS 进行开发以获得良好的类型提示:
```ts ```ts
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
interface PluginOptions { interface PluginOptions {
id: string; id: string;
@ -40,7 +40,7 @@ export default plugin;
假设在项目根目录下有一个自定义插件 `my-plugin` 假设在项目根目录下有一个自定义插件 `my-plugin`
```ts title="my-plugin.ts" ```ts title="my-plugin.ts"
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
const plugin: Plugin = () => ({ const plugin: Plugin = () => ({
name: 'my-plugin', name: 'my-plugin',
@ -112,7 +112,7 @@ export default defineConfig(() => ({
<TabItem value="index.ts" label="src/index.ts"> <TabItem value="index.ts" label="src/index.ts">
```ts ```ts
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
const plugin: Plugin = () => ({ const plugin: Plugin = () => ({
name: '@ice/my-plugin', name: '@ice/my-plugin',
@ -129,7 +129,7 @@ export default plugin;
<TabItem value="runtime.tsx" label="src/runtime.tsx"> <TabItem value="runtime.tsx" label="src/runtime.tsx">
```tsx ```tsx
import type { RuntimePlugin } from '@ice/runtime/esm/types'; import type { RuntimePlugin } from '@ice/runtime/types';
const runtime: RuntimePlugin = async ({ appContext }) => { const runtime: RuntimePlugin = async ({ appContext }) => {
console.log(appContext); console.log(appContext);
@ -470,7 +470,7 @@ export default () => ({
插件运行时可以定制框架的运行时能力: 插件运行时可以定制框架的运行时能力:
```ts ```ts
import type { Plugin } from '@ice/app/esm/types'; import type { Plugin } from '@ice/app/types';
const plugin: Plugin = () => ({ const plugin: Plugin = () => ({
name: 'plugin-name' name: 'plugin-name'
runtime: '/absolute/path/to/runtime', runtime: '/absolute/path/to/runtime',
@ -482,7 +482,7 @@ export default plugin;
框架运行时指向的文件地址为一个 JS 模块,源码阶段推荐用 TS 进行开发: 框架运行时指向的文件地址为一个 JS 模块,源码阶段推荐用 TS 进行开发:
```ts ```ts
import type { RuntimePlugin } from '@ice/runtime/esm/types'; import type { RuntimePlugin } from '@ice/runtime/types';
const runtime: RuntimePlugin = () => {}; const runtime: RuntimePlugin = () => {};
export default runtime; export default runtime;