提交
This commit is contained in:
3636
front-end/app-product/package-lock.json
generated
3636
front-end/app-product/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,6 @@
|
|||||||
"type-check": "vue-tsc --build"
|
"type-check": "vue-tsc --build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.12.2",
|
|
||||||
"pinia": "^3.0.3",
|
"pinia": "^3.0.3",
|
||||||
"vue": "^3.5.18",
|
"vue": "^3.5.18",
|
||||||
"vue-router": "^4.0.6"
|
"vue-router": "^4.0.6"
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { Product } from "@domains/product/domain/entities/Product.ts";
|
import {Product} from "@domains/product/domain/entities/Product.ts";
|
||||||
import { ProductType } from "@domains/product/domain/type/ProductType.ts";
|
import {ProductType} from "@domains/product/domain/type/ProductType.ts";
|
||||||
import { ProductRepository } from "@domains/product/ports/repositories/ProductRepository";
|
import {ProductRepository} from "@domains/product/ports/repositories/ProductRepository";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { http } from "mainApp/shared";
|
import {http} from "shared/infra";
|
||||||
import HttpConfig from "../config/HttpConfig";
|
import HttpConfig from "../config/HttpConfig";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP商品仓储实现 - 实现商品数据的HTTP访问
|
* HTTP商品仓储实现 - 实现商品数据的HTTP访问
|
||||||
* 这是基础设施层,负责具体的数据获取实现
|
* 这是基础设施层,负责具体的数据获取实现
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { defineConfig } from 'vite';
|
import {defineConfig} from 'vite';
|
||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue';
|
||||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
@@ -8,11 +8,10 @@ import {fileURLToPath, URL} from "node:url";
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
federation({
|
federation({
|
||||||
name: 'productModule', // 联邦模块名称(主应用通过此名称引用)
|
name: 'product',
|
||||||
filename: 'remoteEntry.js',
|
|
||||||
// 关键:声明远程模块(主模块)
|
|
||||||
remotes: {
|
remotes: {
|
||||||
mainApp: "http://localhost:5000/assets/remoteEntry.js"
|
mainApp: "http://localhost:5000/assets/remoteEntry.js",
|
||||||
|
shared: 'http://localhost:5555/assets/remoteEntry.js'
|
||||||
},
|
},
|
||||||
exposes: { // 暴露给主应用的资源(按功能分组)
|
exposes: { // 暴露给主应用的资源(按功能分组)
|
||||||
'./ProductDomain': './src/domains/product/index.ts', // 领域层(实体、服务、接口等)
|
'./ProductDomain': './src/domains/product/index.ts', // 领域层(实体、服务、接口等)
|
||||||
@@ -20,7 +19,6 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
shared: {
|
shared: {
|
||||||
vue: { generate:false, requiredVersion: '^3.5.18' },
|
vue: { generate:false, requiredVersion: '^3.5.18' },
|
||||||
axios: { generate:false, requiredVersion: '^1.12.2' },
|
|
||||||
'vue-router': { generate:false, requiredVersion: '^4.0.6' },
|
'vue-router': { generate:false, requiredVersion: '^4.0.6' },
|
||||||
pinia: { generate:false, requiredVersion: '^3.0.3' }
|
pinia: { generate:false, requiredVersion: '^3.0.3' }
|
||||||
}
|
}
|
||||||
|
|||||||
1388
front-end/app-shared/package-lock.json
generated
Normal file
1388
front-end/app-shared/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
front-end/app-shared/package.json
Normal file
22
front-end/app-shared/package.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "app-shared",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite --port 5555 --strictPort",
|
||||||
|
"build": "vite build",
|
||||||
|
"serve": "vite preview --port 5555 --strictPort",
|
||||||
|
"all": "npm run build && npm run serve"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.12.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@originjs/vite-plugin-federation": "^1.4.1",
|
||||||
|
"typescript": "~5.8.0",
|
||||||
|
"vite": "^7.0.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
2
front-end/app-shared/src/config/index.ts
Normal file
2
front-end/app-shared/src/config/index.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export * from './HttpConfig';
|
||||||
|
export * from './ThemeConfig';
|
||||||
3
front-end/app-shared/src/index.ts
Normal file
3
front-end/app-shared/src/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export * from './infra';
|
||||||
|
export * from './utils';
|
||||||
|
export * from './config';
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import axios, { type AxiosInstance, AxiosError, type AxiosRequestConfig, type InternalAxiosRequestConfig } from "axios";
|
import axios, {AxiosError, type AxiosInstance, type AxiosRequestConfig} from "axios";
|
||||||
import { UrlCheckUtils } from '@shared/utils/index'
|
import {UrlCheckUtils} from '../utils/index'
|
||||||
|
|
||||||
|
|
||||||
class AxiosInfra {
|
class AxiosInfra {
|
||||||
1
front-end/app-shared/src/infra/index.ts
Normal file
1
front-end/app-shared/src/infra/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export {default as http} from "./AxiosInfra"
|
||||||
1
front-end/app-shared/src/types/env.d.ts
vendored
Normal file
1
front-end/app-shared/src/types/env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { HttpConfig } from '@shared/config/HttpConfig'
|
import {HttpConfig} from '../config'
|
||||||
|
|
||||||
export default class UrlCheckUtils {
|
export class UrlCheckUtils {
|
||||||
|
|
||||||
public static check() {
|
public static check() {
|
||||||
if (import.meta.env.MODE === 'production') {
|
if (import.meta.env.MODE === 'production') {
|
||||||
1
front-end/app-shared/src/utils/index.ts
Normal file
1
front-end/app-shared/src/utils/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './UrlCheckUtils';
|
||||||
40
front-end/app-shared/tsconfig.json
Normal file
40
front-end/app-shared/tsconfig.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"src/**/*.d.ts",
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist",
|
||||||
|
"**/*.test.ts"
|
||||||
|
],
|
||||||
|
"compilerOptions": {
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"verbatimModuleSyntax": false,
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "ESNext",
|
||||||
|
// 模块导出优化
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
// 允许导入JSON文件
|
||||||
|
"isolatedModules": true,
|
||||||
|
// 确保每个文件可被独立转译(Vite等工具要求)
|
||||||
|
"skipLibCheck": true,
|
||||||
|
// 跳过库类型检查,加快编译速度
|
||||||
|
|
||||||
|
"paths": {
|
||||||
|
"@/*": [
|
||||||
|
"./src/app/*"
|
||||||
|
],
|
||||||
|
"@shared/*": [
|
||||||
|
"./src/shared/*"
|
||||||
|
],
|
||||||
|
"@features/*": [
|
||||||
|
"./src/features/*"
|
||||||
|
],
|
||||||
|
"@domains/*": [
|
||||||
|
"./src/domains/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
31
front-end/app-shared/vite.config.ts
Normal file
31
front-end/app-shared/vite.config.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import {defineConfig} from 'vite'
|
||||||
|
import federation from '@originjs/vite-plugin-federation';
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [
|
||||||
|
federation({
|
||||||
|
name: 'shared',
|
||||||
|
exposes: {
|
||||||
|
"./config": "./src/config/index.ts",
|
||||||
|
"./infra": "./src/infra/index.ts",
|
||||||
|
"./utils": "./src/utils/index.ts",
|
||||||
|
},
|
||||||
|
shared: {
|
||||||
|
axios: {generate: false, requiredVersion: '^1.12.2'}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
],
|
||||||
|
build: {
|
||||||
|
target: 'esnext',
|
||||||
|
minify: false,
|
||||||
|
cssCodeSplit: true,
|
||||||
|
rollupOptions: {
|
||||||
|
input: './src/index.ts',
|
||||||
|
output: {
|
||||||
|
format: 'esm',
|
||||||
|
minifyInternalExports: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
2903
front-end/main-app/package-lock.json
generated
2903
front-end/main-app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,6 @@
|
|||||||
"type-check": "vue-tsc --build"
|
"type-check": "vue-tsc --build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.12.2",
|
|
||||||
"pinia": "^3.0.3",
|
"pinia": "^3.0.3",
|
||||||
"vue": "^3.5.18",
|
"vue": "^3.5.18",
|
||||||
"vue-router": "^4.0.6"
|
"vue-router": "^4.0.6"
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
// 从商品联邦模块导入领域层资源
|
// 从商品联邦模块导入领域层资源
|
||||||
import {
|
import {HttpProductRepository, ProductApplicationService, ProductRepository} from 'product/ProductDomain';
|
||||||
ProductApplicationService,
|
|
||||||
HttpProductRepository,
|
|
||||||
ProductRepository
|
|
||||||
} from 'productModule/ProductDomain';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品领域的依赖注入配置
|
* 商品领域的依赖注入配置
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
|
import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'
|
||||||
import { productRouter } from 'productModule/ProductRouter'
|
import {productRouter} from 'product/ProductRouter'
|
||||||
|
|
||||||
|
console.log("productRouter: ", productRouter)
|
||||||
|
|
||||||
const baseRouter: Array<RouteRecordRaw> = [
|
const baseRouter: Array<RouteRecordRaw> = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { defineComponent, reactive, onMounted } from 'vue'
|
import {defineComponent, onMounted, reactive} from 'vue'
|
||||||
import Header from '@/components/Header'
|
import Header from '@/components/Header'
|
||||||
import { HttpConfig } from '@shared/config/index'
|
// @ts-ignore
|
||||||
import { UrlCheckUtils } from '@shared/utils'
|
import {UrlCheckUtils} from 'shared/utils'
|
||||||
import { useCounterStore } from '@/stores/counter'
|
import {useCounterStore} from '@/stores/counter'
|
||||||
import { storeToRefs } from 'pinia'
|
import {storeToRefs} from 'pinia'
|
||||||
|
|
||||||
interface stateType {
|
interface stateType {
|
||||||
list: ListItemType[]
|
list: ListItemType[]
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
export * from "./config/HttpConfig"
|
|
||||||
export * from "./config/ThemeConfig"
|
|
||||||
export { default as http } from "./infra/AxiosInfra"
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
// 声明领域层类型
|
// 声明领域层类型
|
||||||
declare module 'productModule/ProductDomain' {
|
declare module 'product/ProductDomain' {
|
||||||
import type { DefineComponent } from 'vue';
|
|
||||||
// 商品实体类型(与联邦模块一致)
|
// 商品实体类型(与联邦模块一致)
|
||||||
export class Product {
|
export class Product {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -36,6 +35,6 @@ declare module 'productModule/ProductDomain' {
|
|||||||
// export const ProductDetail: DefineComponent; // 商品详情页
|
// export const ProductDetail: DefineComponent; // 商品详情页
|
||||||
// }
|
// }
|
||||||
|
|
||||||
declare module 'productModule/ProductRouter' {
|
declare module 'product/ProductRouter' {
|
||||||
export const productRouter: RouteRecordRaw[];
|
export const productRouter: RouteRecordRaw[];
|
||||||
}
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
declare module '*.vue' {
|
|
||||||
import Vue from 'vue';
|
|
||||||
export default Vue;
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
import UrlCheckUtils from './UrlCheckUtils';
|
|
||||||
|
|
||||||
export { UrlCheckUtils };
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { fileURLToPath, URL } from 'node:url'
|
import {fileURLToPath, URL} from 'node:url'
|
||||||
|
|
||||||
import { defineConfig } from 'vite'
|
import {defineConfig} from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||||
@@ -15,10 +15,10 @@ export default defineConfig({
|
|||||||
federation({
|
federation({
|
||||||
name: 'mainApp', // 主应用模块名(联邦模块需通过此名引用)
|
name: 'mainApp', // 主应用模块名(联邦模块需通过此名引用)
|
||||||
remotes: { // 配置远程联邦模块地址(开发/生产需对应)
|
remotes: { // 配置远程联邦模块地址(开发/生产需对应)
|
||||||
productModule: 'http://localhost:5001/assets/remoteEntry.js'
|
product: 'http://localhost:5001/assets/remoteEntry.js',
|
||||||
|
shared: 'http://localhost:5555/assets/remoteEntry.js'
|
||||||
},
|
},
|
||||||
exposes: {
|
exposes: {
|
||||||
"./shared": "./src/shared/index.ts",
|
|
||||||
"./productService": "./src/app/di/productModule.ts",
|
"./productService": "./src/app/di/productModule.ts",
|
||||||
},
|
},
|
||||||
shared: {
|
shared: {
|
||||||
|
|||||||
Reference in New Issue
Block a user