Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace TSC bundler by nodenext module resolution #32

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,870 changes: 279 additions & 1,591 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"name": "@aresrpg/aresrpg-world",
"version": "1.7.3",
"version": "1.7.6",
"description": "Procedural voxel terrain generation for AresRPG",
"type": "module",
"source": "src/index.ts",
"main": "dist/index.js",
"types": "dist/types.d.ts",
"scripts": {
"watch": "tsc --watch",
"build": "parcel build",
"clean": "rm -rf .parcel-cache && rm -rf dist/",
"build": "tsc",
"lint": "eslint . --ext .ts && prettier . --check && npm run typecheck",
"typecheck": "tsc --build",
"format": "prettier . --write && eslint . --fix --ext .ts",
Expand Down Expand Up @@ -49,7 +47,6 @@
"eslint-plugin-import": "2.31.0",
"husky": "^4.3.8",
"lint-staged": "15.4.1",
"parcel": "^2.13.3",
"prettier": "3.4.2",
"typescript": "^5.7.3"
},
Expand Down
16 changes: 8 additions & 8 deletions src/config/WorldEnv.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Vector2, Vector3 } from 'three'

import { ItemType } from '../factory/ItemsFactory'
import { BlockType } from '../procgen/Biome'
import { ProcItemConf } from '../tools/ProceduralGenerators'
import { SchematicsBlocksMapping } from '../tools/SchematicLoader'
import { BiomesRawConf, BlockMode } from '../utils/types'

// import { NoiseSamplerParams } from '../procgen/NoiseSampler'
// import { ProcLayerParams } from '../procgen/ProcLayer'
import { ItemType } from '../factory/ItemsFactory.js'
import { BlockType } from '../procgen/Biome.js'
import { ProcItemConf } from '../tools/ProceduralGenerators.js'
import { SchematicsBlocksMapping } from '../tools/SchematicLoader.js'
import { BiomesRawConf, BlockMode } from '../utils/types.js'

// import { NoiseSamplerParams } from '../procgen/NoiseSampler.js'
// import { ProcLayerParams } from '../procgen/ProcLayer.js'

export class WorldEnv {
// eslint-disable-next-line no-use-before-define
Expand Down
4 changes: 2 additions & 2 deletions src/config/demo-samples/configs/biome_landscapes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BiomeType, BlockType } from '../../../index'
import { BiomeType, BlockType } from '../../../index.js'

import { SCHEMATICS_COLLECTIONS } from './schematics_collections'
import { SCHEMATICS_COLLECTIONS } from './schematics_collections.js'

const { alpine, temperate_forest, siberian } = SCHEMATICS_COLLECTIONS

Expand Down
4 changes: 2 additions & 2 deletions src/config/demo-samples/configs/blocks_mappings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BlockType } from '../../../index'
import { typesNumbering } from '../../../utils/misc'
import { BlockType } from '../../../index.js'
import { typesNumbering } from '../../../utils/misc.js'

/**
* Extending world reserved blocks
Expand Down
2 changes: 1 addition & 1 deletion src/config/demo-samples/configs/procedural_items.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ProcItemCategory, ProcItemType } from '../../../index'
import { ProcItemCategory, ProcItemType } from '../../../index.js'

export const proc_items = {
AppleTree_S: 'appletree_s',
Expand Down
10 changes: 5 additions & 5 deletions src/config/demo-samples/configs/world_dev_setup.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// import { SCHEMATICS_FILES_INDEX } from '../assets/schematics/index'
import { WorldEnv } from '../../../index'
// import { SCHEMATICS_FILES_INDEX } from '../assets/schematics/index.js'
import { WorldEnv } from '../../../index.js'

import { BIOMES_LANDSCAPES_CONFIG } from './biome_landscapes'
import { PROC_ITEMS_CONFIG } from './procedural_items'
import { BIOMES_LANDSCAPES_CONFIG } from './biome_landscapes.js'
import { PROC_ITEMS_CONFIG } from './procedural_items.js'
import {
BLOCKS_COLOR_MAPPING,
// ExtBlock,
SCHEMATICS_BLOCKS_MAPPING,
} from './blocks_mappings'
} from './blocks_mappings.js'

/**
* @param worldEnv provide it to setup worker's own env or it will default to main thread env
Expand Down
8 changes: 4 additions & 4 deletions src/datacontainers/ChunkContainer.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Vector2, Box3, Vector3 } from 'three'

import { BlockMode, ChunkId, ChunkKey } from '../utils/types'
import { BlockMode, ChunkId, ChunkKey } from '../utils/types.js'
import {
asVect3,
asChunkBounds,
parseChunkKey,
serializeChunkId,
parseThreeStub,
asVect2,
} from '../utils/convert'
import { WorldEnv } from '../config/WorldEnv'
import { BlockType } from '../index'
} from '../utils/convert.js'
import { WorldEnv } from '../config/WorldEnv.js'
import { BlockType } from '../index.js'

enum ChunkAxisOrder {
ZXY,
Expand Down
6 changes: 3 additions & 3 deletions src/datacontainers/PatchBase.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Vector2, Box2, Vector3 } from 'three'

import { PatchKey } from '../utils/types'
import { PatchKey } from '../utils/types.js'
import {
parsePatchKey,
asPatchBounds,
asVect2,
parseThreeStub,
} from '../utils/convert'
import { WorldEnv } from '../index'
} from '../utils/convert.js'
import { WorldEnv } from '../index.js'

// export class PatchChunkCommon<T> {

Expand Down
14 changes: 7 additions & 7 deletions src/factory/ChunksFactory.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// import { MathUtils, Vector3 } from 'three'
import { Vector3 } from 'three'

import { WorldEnv } from '../config/WorldEnv'
import { asVect2, serializePatchId, asBox2 } from '../utils/convert'
import { BlockMode, ChunkKey, PatchBlock } from '../utils/types'
import { WorldEnv } from '../config/WorldEnv.js'
import { asVect2, serializePatchId, asBox2 } from '../utils/convert.js'
import { BlockMode, ChunkKey, PatchBlock } from '../utils/types.js'
import {
ChunkBuffer,
ChunkContainer,
ChunkMask,
} from '../datacontainers/ChunkContainer'
import { BlockType, Biome, BiomeType, DensityVolume } from '../index'
import { GroundPatch, parseGroundFlags } from '../processing/GroundPatch'
import { clamp } from '../utils/math'
} from '../datacontainers/ChunkContainer.js'
import { BlockType, Biome, BiomeType, DensityVolume } from '../index.js'
import { GroundPatch, parseGroundFlags } from '../processing/GroundPatch.js'
import { clamp } from '../utils/math.js'

export class EmptyChunk extends ChunkContainer {
constructor(chunkKey: ChunkKey) {
Expand Down
8 changes: 4 additions & 4 deletions src/factory/ItemsFactory.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Box3, Vector3 } from 'three'

import { ChunkContainer } from '../datacontainers/ChunkContainer'
import { ProceduralItemGenerator } from '../tools/ProceduralGenerators'
import { SchematicLoader } from '../tools/SchematicLoader'
import { WorldEnv } from '../config/WorldEnv'
import { ChunkContainer } from '../datacontainers/ChunkContainer.js'
import { ProceduralItemGenerator } from '../tools/ProceduralGenerators.js'
import { SchematicLoader } from '../tools/SchematicLoader.js'
import { WorldEnv } from '../config/WorldEnv.js'

export type ItemType = string
export type SpawnedItems = Record<ItemType, Vector3[]>
Expand Down
42 changes: 21 additions & 21 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
// Utils
// export * as WorldUtils from './utils/index'
export { getPatchId, asVect2, asVect3 } from './utils/convert'
export { BlockMode } from './utils/types'
export { getPatchId, asVect2, asVect3 } from './utils/convert.js'
export { BlockMode } from './utils/types.js'
// Processing
export { ProcessingTask } from './processing/TaskProcessing'
export { BatchProcess } from './processing/BatchProcessing'
export { ProcessingTask } from './processing/TaskProcessing.js'
export { BatchProcess } from './processing/BatchProcessing.js'
export {
BlocksProcessing,
BlocksProcessingRecipe,
BlockProcessor,
} from './processing/BlocksProcessing'
export { BoardProcessor, BlockCategory } from './processing/BoardProcessing'
} from './processing/BlocksProcessing.js'
export { BoardProcessor, BlockCategory } from './processing/BoardProcessing.js'
export {
ViewChunksBatch,
LowerChunksBatch,
UpperChunksBatch,
} from './processing/ChunksBatch'
} from './processing/ChunksBatch.js'
export {
PseudoDistributionMap,
DistributionProfile,
} from './processing/RandomDistributionMap'
export { ChunksProcessor } from './processing/ChunksProcessing'
export { ProcessingState } from './processing/TaskProcessing'
} from './processing/RandomDistributionMap.js'
export { ChunksProcessor } from './processing/ChunksProcessing.js'
export { ProcessingState } from './processing/TaskProcessing.js'
// Procgen
export { Biome, BiomeType, BlockType } from './procgen/Biome'
export { Heightmap } from './procgen/Heightmap'
export { DensityVolume } from './procgen/DensityVolume'
export { Biome, BiomeType, BlockType } from './procgen/Biome.js'
export { Heightmap } from './procgen/Heightmap.js'
export { DensityVolume } from './procgen/DensityVolume.js'
// Data structures
// export { GroundContainer, GroundCache } from './datacontainers/PatchesIndexer'
export { ChunkContainer } from './datacontainers/ChunkContainer'
export { ChunkContainer } from './datacontainers/ChunkContainer.js'
// Factory
export { ItemsInventory } from './factory/ItemsFactory'
export { GroundChunk, EmptyChunk, CavesMask } from './factory/ChunksFactory'
export { ItemsInventory } from './factory/ItemsFactory.js'
export { GroundChunk, EmptyChunk, CavesMask } from './factory/ChunksFactory.js'
// Tools
export { SchematicLoader } from './tools/SchematicLoader'
export { SchematicLoader } from './tools/SchematicLoader.js'
export {
ProceduralItemGenerator,
ProcItemType,
ProcItemCategory,
} from './tools/ProceduralGenerators'
// export * as ProceduralGenerators from './tools/ProceduralGenerators'
} from './tools/ProceduralGenerators.js'
// export * as ProceduralGenerators from './tools/ProceduralGenerators.js'
// Config
export { WorldEnv } from './config/WorldEnv'
export { WorldEnv } from './config/WorldEnv.js'
// export * as WorldDevSetup from './config/demo-samples/configs/world_dev_setup'
export {
EnvOverride,
BlocksColorOverride,
} from './config/demo-samples/configs/world_dev_setup'
} from './config/demo-samples/configs/world_dev_setup.js'
2 changes: 1 addition & 1 deletion src/processing/BatchProcessing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ProcessingState, ProcessingTask } from './TaskProcessing'
import { ProcessingState, ProcessingTask } from './TaskProcessing.js'

export class BatchProcess<T extends ProcessingTask> {
// eslint-disable-next-line no-use-before-define
Expand Down
10 changes: 5 additions & 5 deletions src/processing/BlocksProcessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import {
ProcessingTask,
ChunkContainer,
DensityVolume,
} from '../index'
} from '../index.js'
import {
serializePatchId,
getPatchId,
asVect3,
asVect2,
parseThreeStub,
} from '../utils/convert'
import { PatchKey, GroundBlock, Block, BlockData } from '../utils/types'
} from '../utils/convert.js'
import { PatchKey, GroundBlock, Block, BlockData } from '../utils/types.js'

import { GroundBlockData, GroundPatch } from './GroundPatch'
import { ItemsBaker } from './ItemsProcessing'
import { GroundBlockData, GroundPatch } from './GroundPatch.js'
import { ItemsBaker } from './ItemsProcessing.js'

export type BlocksBatchArgs = {
posBatch: Vector2[]
Expand Down
18 changes: 9 additions & 9 deletions src/processing/BoardProcessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ import {
getPatchId,
getUpperScalarId,
serializePatchId,
} from '../utils/convert'
} from '../utils/convert.js'
import {
WorldEnv,
ChunkContainer,
BatchProcess,
ChunksProcessor,
BlockType,
} from '../index'
import { ProcLayer } from '../procgen/ProcLayer'
import { BlockMode, ChunkId, PatchKey } from '../utils/types'
} from '../index.js'
import { ProcLayer } from '../procgen/ProcLayer.js'
import { BlockMode, ChunkId, PatchKey } from '../utils/types.js'
import {
DataContainer,
PatchBase,
PatchElement,
} from '../datacontainers/PatchBase'
import { copySourceToTargetPatch } from '../utils/data'
} from '../datacontainers/PatchBase.js'
import { copySourceToTargetPatch } from '../utils/data.js'

import {
ItemsBaker,
ItemsProcessingParams,
ItemsProcessingRecipes,
} from './ItemsProcessing'
import { ProcessingTask } from './TaskProcessing'
import { ChunksProcessingParams } from './ChunksProcessing'
} from './ItemsProcessing.js'
import { ProcessingTask } from './TaskProcessing.js'
import { ChunksProcessingParams } from './ChunksProcessing.js'
// import { UndegroundChunkset } from './ChunksProcessing'

export enum BlockCategory {
Expand Down
10 changes: 5 additions & 5 deletions src/processing/ChunksBatch.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Box2, Vector2 } from 'three'

import { serializePatchId } from '../utils/convert'
import { PatchKey } from '../utils/types'
import { serializePatchId } from '../utils/convert.js'
import { PatchKey } from '../utils/types.js'

import { BatchProcess } from './BatchProcessing'
import { BatchProcess } from './BatchProcessing.js'
import {
ChunksProcessor,
lowerChunksProcessingParams,
upperChunksProcessingParams,
} from './ChunksProcessing'
import { ProcessingState } from './TaskProcessing'
} from './ChunksProcessing.js'
import { ProcessingState } from './TaskProcessing.js'

// const { patchSize, patchDimensions } = WorldEnv.current

Expand Down
16 changes: 8 additions & 8 deletions src/processing/ChunksProcessing.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { Vector2 } from 'three'

import { WorldEnv } from '../config/WorldEnv'
import { WorldEnv } from '../config/WorldEnv.js'
import {
parsePatchKey,
asVect3,
serializeChunkId,
asPatchBounds,
} from '../utils/convert'
import { ChunkIndex, PatchId, PatchKey } from '../utils/types'
} from '../utils/convert.js'
import { ChunkIndex, PatchId, PatchKey } from '../utils/types.js'
import {
ChunkContainer,
ChunkStub,
defaultDataEncoder,
} from '../datacontainers/ChunkContainer'
import { CavesMask, EmptyChunk, GroundChunk } from '../factory/ChunksFactory'
} from '../datacontainers/ChunkContainer.js'
import { CavesMask, EmptyChunk, GroundChunk } from '../factory/ChunksFactory.js'

import { GroundPatch } from './GroundPatch'
import { ProcessingState, ProcessingTask } from './TaskProcessing'
import { ItemsBaker } from './ItemsProcessing'
import { GroundPatch } from './GroundPatch.js'
import { ProcessingState, ProcessingTask } from './TaskProcessing.js'
import { ItemsBaker } from './ItemsProcessing.js'
const chunksRange = WorldEnv.current.chunks.range
const { patchDimensions: patchDims } = WorldEnv.current

Expand Down
14 changes: 7 additions & 7 deletions src/processing/GroundPatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ import {
PatchBlock,
PatchBoundId,
PatchKey,
} from '../utils/types'
import { asVect3, asVect2 } from '../utils/convert'
import { BlockMode, Heightmap, WorldEnv } from '../index'
} from '../utils/types.js'
import { asVect3, asVect2 } from '../utils/convert.js'
import { BlockMode, Heightmap, WorldEnv } from '../index.js'
import {
Biome,
BiomeInfluence,
BiomeNumericType,
BiomeType,
BlockType,
ReverseBiomeNumericType,
} from '../procgen/Biome'
} from '../procgen/Biome.js'
import {
PatchBase,
PatchDataContainer,
PatchStub,
} from '../datacontainers/PatchBase'
import { getPatchBoundingPoints } from '../utils/spatial'
import { bilinearInterpolation } from '../utils/math'
} from '../datacontainers/PatchBase.js'
import { getPatchBoundingPoints } from '../utils/spatial.js'
import { bilinearInterpolation } from '../utils/math.js'

export type PatchBoundingBiomes = Record<PatchBoundId, BiomeInfluence>

Expand Down
Loading
Loading