Skip to content

Commit 6945b02

Browse files
committed
Bundle sandstone to a single file
1 parent c54096e commit 6945b02

File tree

11 files changed

+52
-283
lines changed

11 files changed

+52
-283
lines changed

package.json

Lines changed: 5 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -76,102 +76,16 @@
7676
"url": "git+https://github.com/sandstone-mc/sandstone.git"
7777
},
7878
"scripts": {
79-
"build": "tsup --tsconfig tsconfig.build.json --onSuccess \"pnpm run setup\"",
80-
"watch": "tsup --tsconfig tsconfig.build.json --onSuccess \"pnpm run setup\" --watch",
81-
"build-types": "tsc --project tsconfig.build.json",
82-
"setup-package": "node ./scripts/setupPackage.mjs",
83-
"setup": "pnpm run build-types && pnpm run setup-package && echo ✔️ Successfully built Sandstone.",
79+
"build": "tsup --tsconfig tsconfig.json && echo ✔️ Successfully built Sandstone.",
80+
"watch": "tsup --tsconfig tsconfig.json --onSuccess \"echo ✔️ Successfully built Sandstone.\" --watch",
8481
"publishToNpm": "pnpm run build && pnpm publish",
8582
"format": "biome format --write src",
8683
"lint": "biome lint src",
8784
"check": "biome check --write src",
8885
"test": "vitest",
8986
"test:run": "vitest run"
9087
},
91-
"type": "module",
92-
"main": "index.js",
93-
"module": "index.js",
94-
"types": "index.d.ts",
95-
"exports": {
96-
".": {
97-
"types": "./dist/index.d.ts",
98-
"import": "./dist/index.js",
99-
"default": "./dist/index.js"
100-
},
101-
"./*": {
102-
"types": "./dist/*.d.ts",
103-
"import": "./dist/*.js",
104-
"default": "./dist/*.js"
105-
},
106-
"./arguments": {
107-
"types": "./dist/arguments/index.d.ts",
108-
"import": "./dist/arguments/index.js",
109-
"default": "./dist/arguments/index.js"
110-
},
111-
"./arguments/generated": {
112-
"types": "./dist/arguments/generated/index.d.ts",
113-
"import": "./dist/arguments/generated/index.js",
114-
"default": "./dist/arguments/generated/index.js"
115-
},
116-
"./arguments/resources": {
117-
"types": "./dist/arguments/resources/index.d.ts",
118-
"import": "./dist/arguments/resources/index.js",
119-
"default": "./dist/arguments/resources/index.js"
120-
},
121-
"./arguments/resources/criteria": {
122-
"types": "./dist/arguments/resources/criteria/index.d.ts",
123-
"import": "./dist/arguments/resources/criteria/index.js",
124-
"default": "./dist/arguments/resources/criteria/index.js"
125-
},
126-
"./commands": {
127-
"types": "./dist/commands/index.d.ts",
128-
"import": "./dist/commands/index.js",
129-
"default": "./dist/commands/index.js"
130-
},
131-
"./commands/implementations": {
132-
"types": "./dist/commands/implementations/index.d.ts",
133-
"import": "./dist/commands/implementations/index.js",
134-
"default": "./dist/commands/implementations/index.js"
135-
},
136-
"./core": {
137-
"types": "./dist/core/index.d.ts",
138-
"import": "./dist/core/index.js",
139-
"default": "./dist/core/index.js"
140-
},
141-
"./core/resources": {
142-
"types": "./dist/core/resources/index.d.ts",
143-
"import": "./dist/core/resources/index.js",
144-
"default": "./dist/core/resources/index.js"
145-
},
146-
"./flow": {
147-
"types": "./dist/flow/index.d.ts",
148-
"import": "./dist/flow/index.js",
149-
"default": "./dist/flow/index.js"
150-
},
151-
"./flow/conditions": {
152-
"types": "./dist/flow/conditions/index.d.ts",
153-
"import": "./dist/flow/conditions/index.js",
154-
"default": "./dist/flow/conditions/index.js"
155-
},
156-
"./pack": {
157-
"types": "./dist/pack/index.d.ts",
158-
"import": "./dist/pack/index.js",
159-
"default": "./dist/pack/index.js"
160-
},
161-
"./pack/visitors": {
162-
"types": "./dist/pack/visitors/index.d.ts",
163-
"import": "./dist/pack/visitors/index.js",
164-
"default": "./dist/pack/visitors/index.js"
165-
},
166-
"./variables": {
167-
"types": "./dist/variables/index.d.ts",
168-
"import": "./dist/variables/index.js",
169-
"default": "./dist/variables/index.js"
170-
},
171-
"./variables/nbt": {
172-
"types": "./dist/variables/nbt/index.d.ts",
173-
"import": "./dist/variables/nbt/index.js",
174-
"default": "./dist/variables/nbt/index.js"
175-
}
176-
}
88+
"main": "dist/index.cjs",
89+
"module": "dist/index.mjs",
90+
"types": "dist/index.d.ts"
17791
}

scripts/setupPackage.mjs

Lines changed: 0 additions & 81 deletions
This file was deleted.

src/arguments/resources/datapack/itemModifier.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
// @ts-nocheck
2-
3-
/* eslint-disable camelcase */
41
import type { JSONTextComponent, LootTableEntry } from 'sandstone/arguments'
52
import type { BASIC_COLORS, MAP_ICONS } from 'sandstone/arguments/basics'
63
import type { ATTRIBUTES, BLOCKS, ENCHANTMENTS, STRUCTURES } from 'sandstone/arguments/generated'
74
import type { LootTableClass } from 'sandstone/core'
85
import type { LiteralUnion } from 'sandstone/utils'
9-
import type { DataInstance } from 'sandstone/variables/Data'
6+
import type { DataPointClass } from 'sandstone/variables/Data'
107
import type { NumberProvider } from './criteria/utils.js'
118
import type { ObjectOrArray, PredicateCondition } from './predicate.js'
129

@@ -128,7 +125,7 @@ export type ItemModifierFunction = {
128125
}
129126
| {
130127
type: 'minecraft:storage'
131-
source: string | DataInstance<'storage'>
128+
source: string | DataPointClass<'storage'>
132129
}
133130

134131
/** A list of operations. */

src/commands/commands.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/** @biome-ignore */
2+
13
import type { SandstonePack } from 'sandstone/pack/index.js'
24
import { PlaceCommand } from './implementations/block/place.js'
35
import { DamageCommand } from './implementations/entity/damage.js'
@@ -32,6 +34,7 @@ import {
3234
MeCommand,
3335
ParticleCommand,
3436
PlaySoundCommand,
37+
RandomCommand,
3538
RawCommand,
3639
RecipeCommand,
3740
ReloadCommand,
@@ -61,7 +64,6 @@ import {
6164
WeatherCommand,
6265
WorldBorderCommand,
6366
} from './implementations/index.js'
64-
import { RandomCommand } from './implementations/server/random.js'
6567

6668
function bind<CLASS, METHOD extends string>(pack: SandstonePack, _class: CLASS, method: METHOD) {
6769
/* @ts-ignore */

tests/tsconfig.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MCFunction, sandstonePack, say } from 'sandstone'
2+
import { SayCommandNode } from 'sandstone/commands'
23
import type { CommandNode, Node } from 'sandstone/core'
34
import { describe, expect, it } from 'vitest'
4-
import { SayCommandNode } from '../dist/commands'
55

66
type ConstructorArgsWithoutFirst<T extends new (...args: any) => any> = T extends new (
77
first: any,

tsconfig.base.json

Lines changed: 0 additions & 65 deletions
This file was deleted.

tsconfig.build.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

tsconfig.json

100755100644
Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
11
{
2-
"files": [],
3-
"references": [
4-
{ "path": "./tsconfig.build.json" },
5-
{ "path": "./tests/tsconfig.json" }
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": {
5+
"sandstone": [
6+
"./src/index.ts"
7+
],
8+
"sandstone/*": [
9+
"./src/*"
10+
]
11+
},
12+
"types": [
13+
"node"
14+
],
15+
"module": "NodeNext",
16+
"target": "ESNEXT",
17+
"resolveJsonModule": true,
18+
"isolatedModules": true,
19+
"strict": true,
20+
"allowSyntheticDefaultImports": true,
21+
"esModuleInterop": true,
22+
"skipLibCheck": true,
23+
"forceConsistentCasingInFileNames": true,
24+
"rootDir": ".",
25+
},
26+
"include": [
27+
"src",
28+
"tests",
629
]
730
}

0 commit comments

Comments
 (0)