castle-web-cli 0.4.96 → 0.4.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kits/basic-2d/editors/behaviorRegistry.js +5 -5
- package/kits/basic-2d/engine/behaviorExtensions.js +3 -3
- package/kits/basic-2d/engine/files.js +8 -5
- package/kits/basic-2d/engine/systemRegistry.js +2 -2
- package/kits/physics-2d/editors/behaviorRegistry.js +5 -5
- package/kits/physics-2d/engine/files.js +8 -5
- package/kits/physics-2d/engine/systemRegistry.js +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Discover every behavior class from `behaviors/*.jsx` and the physics module's
|
|
2
|
-
// `physics/behaviors
|
|
2
|
+
// `physics/behaviors/**/*.jsx`. Vite HMR is off, so a newly-added behavior file is
|
|
3
3
|
// picked up on the next reload/restart. The physics glob is what lets the
|
|
4
4
|
// self-contained physics module ship its behaviors without polluting the core
|
|
5
5
|
// `behaviors/` folder — a kit adopts physics by copying `physics/` in.
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// own behaviors last: collectBehaviors keys by behaviorName, so a behavior the
|
|
9
9
|
// deck defines wins over one of the same name from a dependency.
|
|
10
10
|
const modules = {
|
|
11
|
-
...import.meta.glob('/imports/*/behaviors
|
|
12
|
-
...import.meta.glob('/imports/*/physics/behaviors
|
|
13
|
-
...import.meta.glob('/behaviors
|
|
14
|
-
...import.meta.glob('/physics/behaviors
|
|
11
|
+
...import.meta.glob('/imports/*/behaviors/**/*.jsx', { eager: true }),
|
|
12
|
+
...import.meta.glob('/imports/*/physics/behaviors/**/*.jsx', { eager: true }),
|
|
13
|
+
...import.meta.glob('/behaviors/**/*.jsx', { eager: true }),
|
|
14
|
+
...import.meta.glob('/physics/behaviors/**/*.jsx', { eager: true }),
|
|
15
15
|
};
|
|
16
16
|
function isBehaviorClass(value) {
|
|
17
17
|
return typeof value === 'function' && typeof value.behaviorName === 'string';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// add fields to a behavior defined in the shared core WITHOUT editing that
|
|
3
3
|
// behavior's file -- so the core behavior stays byte-identical across kits and
|
|
4
4
|
// the module owns its own additions. Each extension module under any
|
|
5
|
-
// `<module>/extensions
|
|
5
|
+
// `<module>/extensions/**/*.js` exports:
|
|
6
6
|
//
|
|
7
7
|
// export const behaviorExtension = {
|
|
8
8
|
// behaviorName: 'Collider',
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
// basic-2d). Symmetric with engine/systemRegistry.js and editors/behaviorRegistry.js.
|
|
17
17
|
// Root-anchored, deck + imports (see engine/files.js).
|
|
18
18
|
const modules = {
|
|
19
|
-
...import.meta.glob('/imports/*/*/extensions
|
|
20
|
-
...import.meta.glob('/*/extensions
|
|
19
|
+
...import.meta.glob('/imports/*/*/extensions/**/*.js', { eager: true }),
|
|
20
|
+
...import.meta.glob('/*/extensions/**/*.js', { eager: true }),
|
|
21
21
|
};
|
|
22
22
|
const extensions = Object.values(modules)
|
|
23
23
|
.map((mod) => mod.behaviorExtension)
|
|
@@ -8,20 +8,23 @@
|
|
|
8
8
|
// The first glob adds every import's content, keyed by its full path
|
|
9
9
|
// (`imports/<alias>/drawings/rock.pxart`) -- which is exactly how a scene or
|
|
10
10
|
// blueprint refers to a dependency's file, so no lookup elsewhere changes.
|
|
11
|
+
// Recursive (`**`), because the files panel shows these folders recursively and
|
|
12
|
+
// so lets you organize inside them -- a flat `drawings/*.pxart` meant art moved
|
|
13
|
+
// into a subfolder vanished from the map, and so from the editor and the game.
|
|
11
14
|
// (Patterns and options must be literals: import.meta.glob is a compile-time
|
|
12
15
|
// transform, so these can't be hoisted into shared constants.)
|
|
13
16
|
const rawModules = {
|
|
14
17
|
...import.meta.glob(
|
|
15
18
|
[
|
|
16
|
-
'/imports/*/scenes
|
|
17
|
-
'/imports/*/blueprints
|
|
18
|
-
'/imports/*/drawings
|
|
19
|
-
'/imports/*/behaviors
|
|
19
|
+
'/imports/*/scenes/**/*.scene',
|
|
20
|
+
'/imports/*/blueprints/**/*.scene',
|
|
21
|
+
'/imports/*/drawings/**/*.pxart',
|
|
22
|
+
'/imports/*/behaviors/**/*.jsx',
|
|
20
23
|
],
|
|
21
24
|
{ query: '?raw', import: 'default', eager: true }
|
|
22
25
|
),
|
|
23
26
|
...import.meta.glob(
|
|
24
|
-
['/scenes
|
|
27
|
+
['/scenes/**/*.scene', '/blueprints/**/*.scene', '/drawings/**/*.pxart', '/behaviors/**/*.jsx'],
|
|
25
28
|
{ query: '?raw', import: 'default', eager: true }
|
|
26
29
|
),
|
|
27
30
|
};
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
// with editors/behaviorRegistry.js.
|
|
9
9
|
// Root-anchored, deck + imports (see engine/files.js).
|
|
10
10
|
const modules = {
|
|
11
|
-
...import.meta.glob('/imports/*/systems
|
|
12
|
-
...import.meta.glob('/systems
|
|
11
|
+
...import.meta.glob('/imports/*/systems/**/*.js', { eager: true }),
|
|
12
|
+
...import.meta.glob('/systems/**/*.js', { eager: true }),
|
|
13
13
|
};
|
|
14
14
|
export const systemInstallers = Object.values(modules)
|
|
15
15
|
.map((mod) => mod.installSystem)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Discover every behavior class from `behaviors/*.jsx` and the physics module's
|
|
2
|
-
// `physics/behaviors
|
|
2
|
+
// `physics/behaviors/**/*.jsx`. Vite HMR is off, so a newly-added behavior file is
|
|
3
3
|
// picked up on the next reload/restart. The physics glob is what lets the
|
|
4
4
|
// self-contained physics module ship its behaviors without polluting the core
|
|
5
5
|
// `behaviors/` folder — a kit adopts physics by copying `physics/` in.
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// own behaviors last: collectBehaviors keys by behaviorName, so a behavior the
|
|
9
9
|
// deck defines wins over one of the same name from a dependency.
|
|
10
10
|
const modules = {
|
|
11
|
-
...import.meta.glob('/imports/*/behaviors
|
|
12
|
-
...import.meta.glob('/imports/*/physics/behaviors
|
|
13
|
-
...import.meta.glob('/behaviors
|
|
14
|
-
...import.meta.glob('/physics/behaviors
|
|
11
|
+
...import.meta.glob('/imports/*/behaviors/**/*.jsx', { eager: true }),
|
|
12
|
+
...import.meta.glob('/imports/*/physics/behaviors/**/*.jsx', { eager: true }),
|
|
13
|
+
...import.meta.glob('/behaviors/**/*.jsx', { eager: true }),
|
|
14
|
+
...import.meta.glob('/physics/behaviors/**/*.jsx', { eager: true }),
|
|
15
15
|
};
|
|
16
16
|
function isBehaviorClass(value) {
|
|
17
17
|
return typeof value === 'function' && typeof value.behaviorName === 'string';
|
|
@@ -8,20 +8,23 @@
|
|
|
8
8
|
// The first glob adds every import's content, keyed by its full path
|
|
9
9
|
// (`imports/<alias>/drawings/rock.pxart`) -- which is exactly how a scene or
|
|
10
10
|
// blueprint refers to a dependency's file, so no lookup elsewhere changes.
|
|
11
|
+
// Recursive (`**`), because the files panel shows these folders recursively and
|
|
12
|
+
// so lets you organize inside them -- a flat `drawings/*.pxart` meant art moved
|
|
13
|
+
// into a subfolder vanished from the map, and so from the editor and the game.
|
|
11
14
|
// (Patterns and options must be literals: import.meta.glob is a compile-time
|
|
12
15
|
// transform, so these can't be hoisted into shared constants.)
|
|
13
16
|
const rawModules = {
|
|
14
17
|
...import.meta.glob(
|
|
15
18
|
[
|
|
16
|
-
'/imports/*/scenes
|
|
17
|
-
'/imports/*/blueprints
|
|
18
|
-
'/imports/*/drawings
|
|
19
|
-
'/imports/*/behaviors
|
|
19
|
+
'/imports/*/scenes/**/*.scene',
|
|
20
|
+
'/imports/*/blueprints/**/*.scene',
|
|
21
|
+
'/imports/*/drawings/**/*.pxart',
|
|
22
|
+
'/imports/*/behaviors/**/*.jsx',
|
|
20
23
|
],
|
|
21
24
|
{ query: '?raw', import: 'default', eager: true }
|
|
22
25
|
),
|
|
23
26
|
...import.meta.glob(
|
|
24
|
-
['/scenes
|
|
27
|
+
['/scenes/**/*.scene', '/blueprints/**/*.scene', '/drawings/**/*.pxart', '/behaviors/**/*.jsx'],
|
|
25
28
|
{ query: '?raw', import: 'default', eager: true }
|
|
26
29
|
),
|
|
27
30
|
};
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
// with editors/behaviorRegistry.js.
|
|
9
9
|
// Root-anchored, deck + imports (see engine/files.js).
|
|
10
10
|
const modules = {
|
|
11
|
-
...import.meta.glob('/imports/*/systems
|
|
12
|
-
...import.meta.glob('/systems
|
|
11
|
+
...import.meta.glob('/imports/*/systems/**/*.js', { eager: true }),
|
|
12
|
+
...import.meta.glob('/systems/**/*.js', { eager: true }),
|
|
13
13
|
};
|
|
14
14
|
export const systemInstallers = Object.values(modules)
|
|
15
15
|
.map((mod) => mod.installSystem)
|