Convert project to ESM (#58)
* Convert to ESM, enforce file single naming convention. * Update fs-extra esm usage. * Fix minimatch import. * fixes * triple-beam issue is finally fixed.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { BaseFileStructure } from '../BaseFileStructure'
|
||||
import { SpecModelStructure } from './SpecModelStructure'
|
||||
import { BaseFileStructure } from '../BaseFileStructure.js'
|
||||
import { SpecModelStructure } from './SpecModelStructure.js'
|
||||
|
||||
export abstract class BaseModelStructure<T> extends BaseFileStructure implements SpecModelStructure<T[]> {
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { mkdirs, writeFile, readFile, pathExists } from 'fs-extra'
|
||||
import { mkdirs, pathExists } from 'fs-extra/esm'
|
||||
import { readFile, writeFile } from 'fs/promises'
|
||||
import { Distribution } from 'helios-distribution-types'
|
||||
import { SpecModelStructure } from './SpecModelStructure'
|
||||
import { ServerStructure } from './Server.struct'
|
||||
import { SpecModelStructure } from './SpecModelStructure.js'
|
||||
import { ServerStructure } from './Server.struct.js'
|
||||
import { join, resolve } from 'path'
|
||||
import { DistroMeta, getDefaultDistroMeta } from '../../model/nebula/distrometa'
|
||||
import { addSchemaToObject, SchemaTypes } from '../../util/SchemaUtil'
|
||||
import { LoggerUtil } from '../../util/LoggerUtil'
|
||||
import { DistroMeta, getDefaultDistroMeta } from '../../model/nebula/DistroMeta.js'
|
||||
import { addSchemaToObject, SchemaTypes } from '../../util/SchemaUtil.js'
|
||||
import { LoggerUtil } from '../../util/LoggerUtil.js'
|
||||
|
||||
const logger = LoggerUtil.getLogger('DistributionStructure')
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { lstat, mkdirs, pathExists, readdir, readFile, writeFile } from 'fs-extra'
|
||||
import { mkdirs, pathExists } from 'fs-extra/esm'
|
||||
import { lstat, readdir, readFile, writeFile } from 'fs/promises'
|
||||
import { Server, Module } from 'helios-distribution-types'
|
||||
import { dirname, join, resolve as resolvePath } from 'path'
|
||||
import { URL } from 'url'
|
||||
import { VersionSegmentedRegistry } from '../../util/VersionSegmentedRegistry'
|
||||
import { ServerMeta, getDefaultServerMeta, ServerMetaOptions, UntrackedFilesOption } from '../../model/nebula/servermeta'
|
||||
import { BaseModelStructure } from './BaseModel.struct'
|
||||
import { MiscFileStructure } from './module/File.struct'
|
||||
import { LibraryStructure } from './module/Library.struct'
|
||||
import { MinecraftVersion } from '../../util/MinecraftVersion'
|
||||
import { addSchemaToObject, SchemaTypes } from '../../util/SchemaUtil'
|
||||
import { VersionSegmentedRegistry } from '../../util/VersionSegmentedRegistry.js'
|
||||
import { ServerMeta, getDefaultServerMeta, ServerMetaOptions, UntrackedFilesOption } from '../../model/nebula/ServerMeta.js'
|
||||
import { BaseModelStructure } from './BaseModel.struct.js'
|
||||
import { MiscFileStructure } from './module/File.struct.js'
|
||||
import { LibraryStructure } from './module/Library.struct.js'
|
||||
import { MinecraftVersion } from '../../util/MinecraftVersion.js'
|
||||
import { addSchemaToObject, SchemaTypes } from '../../util/SchemaUtil.js'
|
||||
|
||||
export class ServerStructure extends BaseModelStructure<Server> {
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FileStructure } from '../FileStructure'
|
||||
import { FileStructure } from '../FileStructure.js'
|
||||
|
||||
export interface SpecModelStructure<T> extends FileStructure {
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import { Stats } from 'fs'
|
||||
import { Type, Module } from 'helios-distribution-types'
|
||||
import { URL } from 'url'
|
||||
import { ModuleStructure } from './Module.struct'
|
||||
import { readdir, stat } from 'fs-extra'
|
||||
import { ModuleStructure } from './Module.struct.js'
|
||||
import { readdir, stat } from 'fs/promises'
|
||||
import { join, resolve, sep } from 'path'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/servermeta'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion.js'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/ServerMeta.js'
|
||||
|
||||
export class MiscFileStructure extends ModuleStructure {
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Stats } from 'fs-extra'
|
||||
import { Stats } from 'fs'
|
||||
import { Type, Module } from 'helios-distribution-types'
|
||||
import { join } from 'path'
|
||||
import { URL } from 'url'
|
||||
import { VersionSegmented } from '../../../util/VersionSegmented'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion'
|
||||
import { ToggleableModuleStructure } from './ToggleableModule.struct'
|
||||
import { LibraryType } from '../../../model/claritas/ClaritasLibraryType'
|
||||
import { ClaritasException } from './Module.struct'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/servermeta'
|
||||
import { VersionSegmented } from '../../../util/VersionSegmented.js'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion.js'
|
||||
import { ToggleableModuleStructure } from './ToggleableModule.struct.js'
|
||||
import { LibraryType } from '../../../model/claritas/ClaritasLibraryType.js'
|
||||
import { ClaritasException } from './Module.struct.js'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/ServerMeta.js'
|
||||
|
||||
export abstract class BaseForgeModStructure extends ToggleableModuleStructure implements VersionSegmented {
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { ModuleStructure } from './Module.struct'
|
||||
import { ModuleStructure } from './Module.struct.js'
|
||||
import { Type, TypeMetadata } from 'helios-distribution-types'
|
||||
import { Stats } from 'fs-extra'
|
||||
import { Stats } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { URL } from 'url'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/servermeta'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion.js'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/ServerMeta.js'
|
||||
|
||||
export class LibraryStructure extends ModuleStructure {
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import minimatch from 'minimatch'
|
||||
import { minimatch } from 'minimatch'
|
||||
import { createHash } from 'crypto'
|
||||
import { lstat, pathExists, readdir, readFile, Stats } from 'fs-extra'
|
||||
import { pathExists } from 'fs-extra/esm'
|
||||
import { Stats } from 'fs'
|
||||
import { lstat, readdir, readFile } from 'fs/promises'
|
||||
import { Artifact, Module, Type, TypeMetadata } from 'helios-distribution-types'
|
||||
import { resolve } from 'path'
|
||||
import { BaseModelStructure } from '../BaseModel.struct'
|
||||
import { LibraryType } from '../../../model/claritas/ClaritasLibraryType'
|
||||
import { ClaritasResult, ClaritasModuleMetadata } from '../../../model/claritas/ClaritasResult'
|
||||
import { ClaritasWrapper } from '../../../util/java/ClaritasWrapper'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/servermeta'
|
||||
import { BaseModelStructure } from '../BaseModel.struct.js'
|
||||
import { LibraryType } from '../../../model/claritas/ClaritasLibraryType.js'
|
||||
import { ClaritasResult, ClaritasModuleMetadata } from '../../../model/claritas/ClaritasResult.js'
|
||||
import { ClaritasWrapper } from '../../../util/java/ClaritasWrapper.js'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion.js'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/ServerMeta.js'
|
||||
|
||||
export interface ModuleCandidate {
|
||||
file: string
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { ModuleStructure, ModuleCandidate } from './Module.struct'
|
||||
import { ModuleStructure, ModuleCandidate } from './Module.struct.js'
|
||||
import { Type, Module } from 'helios-distribution-types'
|
||||
import { Stats, mkdirs } from 'fs-extra'
|
||||
import { mkdirs } from 'fs-extra/esm'
|
||||
import { Stats } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/servermeta'
|
||||
import { MinecraftVersion } from '../../../util/MinecraftVersion.js'
|
||||
import { UntrackedFilesOption } from '../../../model/nebula/ServerMeta.js'
|
||||
|
||||
export enum ToggleableNamespace {
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import StreamZip from 'node-stream-zip'
|
||||
import toml from 'toml'
|
||||
import { capitalize } from '../../../../util/stringutils'
|
||||
import { VersionUtil } from '../../../../util/versionutil'
|
||||
import { ModsToml } from '../../../../model/forge/modstoml'
|
||||
import { BaseForgeModStructure } from '../ForgeMod.struct'
|
||||
import { MinecraftVersion } from '../../../../util/MinecraftVersion'
|
||||
import { UntrackedFilesOption } from '../../../../model/nebula/servermeta'
|
||||
import { capitalize } from '../../../../util/StringUtils.js'
|
||||
import { VersionUtil } from '../../../../util/VersionUtil.js'
|
||||
import { ModsToml } from '../../../../model/forge/ModsToml.js'
|
||||
import { BaseForgeModStructure } from '../ForgeMod.struct.js'
|
||||
import { MinecraftVersion } from '../../../../util/MinecraftVersion.js'
|
||||
import { UntrackedFilesOption } from '../../../../model/nebula/ServerMeta.js'
|
||||
|
||||
export class ForgeModStructure113 extends BaseForgeModStructure {
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import StreamZip from 'node-stream-zip'
|
||||
import { capitalize } from '../../../../util/stringutils'
|
||||
import { VersionUtil } from '../../../../util/versionutil'
|
||||
import { McModInfo } from '../../../../model/forge/mcmodinfo'
|
||||
import { McModInfoList } from '../../../../model/forge/mcmodinfolist'
|
||||
import { BaseForgeModStructure } from '../ForgeMod.struct'
|
||||
import { MinecraftVersion } from '../../../../util/MinecraftVersion'
|
||||
import { ForgeModType_1_7 } from '../../../../model/claritas/ClaritasResult'
|
||||
import { UntrackedFilesOption } from '../../../../model/nebula/servermeta'
|
||||
import { capitalize } from '../../../../util/StringUtils.js'
|
||||
import { VersionUtil } from '../../../../util/VersionUtil.js'
|
||||
import { McModInfo } from '../../../../model/forge/McModInfo.js'
|
||||
import { McModInfoList } from '../../../../model/forge/McModInfoList.js'
|
||||
import { BaseForgeModStructure } from '../ForgeMod.struct.js'
|
||||
import { MinecraftVersion } from '../../../../util/MinecraftVersion.js'
|
||||
import { ForgeModType_1_7 } from '../../../../model/claritas/ClaritasResult.js'
|
||||
import { UntrackedFilesOption } from '../../../../model/nebula/ServerMeta.js'
|
||||
|
||||
export class ForgeModStructure17 extends BaseForgeModStructure {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user