change to use esm

This commit is contained in:
wancat committed 2024-01-30 09:06:41 +08:00
1 parent eb231e4056
commit 78966d351f
10 files changed
+47 -17

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@
"app": "yarn workspace app dev", "app": "yarn workspace app dev",
"app:local": "yarn workspace app dev:local", "app:local": "yarn workspace app dev:local",
"build": "yarn workspace app build", "build": "yarn workspace app build",
"build:watch": "concurrently -n app,server,file-graph,utils -c blue,green,yellow,cyan \"tsc -w -p app\" \"tsc -w -p server\", \"tsc -w -p packages/file-graph\", \"tsc -w -p packages/utils\"", "build:watch": "concurrently -n server,file-graph,utils,models,constants -c blue,green,yellow,cyan,red \"tsc -w -p server\" \"tsc -w -p packages/file-graph\" \"tsc -w -p packages/utils\" \"tsc -w -p packages/models\" \"tsc -w -p packages/constants\"",
"server": "yarn workspace server dev", "server": "yarn workspace server dev",
"cli": "yarn workspace client start", "cli": "yarn workspace client start",
"lint": "eslint .", "lint": "eslint .",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@linux-odyssey/constants", "name": "@linux-odyssey/constants",
"type": "commonjs", "type": "module",
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@linux-odyssey/file-graph", "name": "@linux-odyssey/file-graph",
"version": "1.0.0", "version": "1.0.0",
"type": "commonjs", "type": "module",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"exports": "./dist/index.js", "exports": "./dist/index.js",
+1 -1
View File
@@ -1,5 +1,5 @@
/* eslint-disable lines-between-class-members */ /* eslint-disable lines-between-class-members */
import { basename } from './utils' import { basename } from './utils.js'
interface FileObject { interface FileObject {
path: string path: string
+2 -2
View File
@@ -1,9 +1,9 @@
import File from './file' import File from './file.js'
import { import {
DuplicateItemError, DuplicateItemError,
ParentNotExistsError, ParentNotExistsError,
FileNotExistsError, FileNotExistsError,
} from './errors' } from './errors.js'
import { basename, dirname } from './utils.js' import { basename, dirname } from './utils.js'
export default class FileNode extends File { export default class FileNode extends File {
+1 -1
View File
@@ -1,3 +1,3 @@
export { default as File } from './file' export { default as File } from './file.js'
export { default as FileNode } from './fileNode.js' export { default as FileNode } from './fileNode.js'
export { default as FileGraph } from './fileGraph.js' export { default as FileGraph } from './fileGraph.js'
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@linux-odyssey/models", "name": "@linux-odyssey/models",
"type": "commonjs", "type": "module",
"version": "1.0.0", "version": "1.0.0",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "@linux-odyssey/utils", "name": "@linux-odyssey/utils",
"version": "1.0.0", "version": "1.0.0",
"main": "dist/index.js", "main": "dist/index.js",
"type": "commonjs", "type": "module",
"exports": "./dist/index.js", "exports": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
"license": "MIT", "license": "MIT",
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "server", "name": "server",
"version": "0.0.0", "version": "0.0.0",
"description": "Linux Odyssey Server", "description": "Linux Odyssey Server",
"type": "commonjs", "type": "module",
"scripts": { "scripts": {
"start": "node dist/index.js", "start": "node dist/index.js",
"dev": "nodemon", "dev": "nodemon",
+37 -7
View File
@@ -1,12 +1,42 @@
{ {
// "compilerOptions": {
// "target": "ESNext",
// "module": "ESNext",
// "moduleResolution": "Bundler",
// "strict": true,
// "moduleDetection": "force",
// "skipLibCheck": true,
// "esModuleInterop": true,
// "declaration": true,
// "sourceMap": true,
// "allowJs": true,
// "resolveJsonModule": true,
// "isolatedModules": true,
// "lib": ["ESNext"]
// }
// "compilerOptions": {
// "esModuleInterop": true,
// "skipLibCheck": true,
// "target": "ESNext",
// "resolveJsonModule": true,
// "isolatedModules": true,
// "moduleDetection": "force",
// "strict": false,
// "noUncheckedIndexedAccess": true,
// "moduleResolution": "NodeNext",
// "module": "NodeNext",
// "noEmit": true,
// "lib": ["es2022", "dom", "dom.iterable"]
// }
"compilerOptions": { "compilerOptions": {
"target": "ES2020", "target": "ESNext", // 要編譯成的 JS 目標版本
"module": "CommonJS", "module": "NodeNext", // 要編譯成的 module
"moduleResolution": "node", "moduleResolution": "NodeNext", // module 解析方式, default "classic"
"esModuleInterop": true, // module 兼容, 會影響 build 方式
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"strict": true, "strict": true,
"esModuleInterop": true, "skipLibCheck": true,
"declaration": true, "outDir": "dist"
"sourceMap": true,
"allowJs": true
} }
} }