onejs-core 2.0.21 → 2.0.22

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/bin/oj.js CHANGED
@@ -36,7 +36,7 @@ function findAssetsDir(startDir, explicit) {
36
36
  if (fs.existsSync(explicit) && fs.statSync(explicit).isDirectory()) return explicit
37
37
  return null
38
38
  }
39
- let dir = startDir
39
+ let dir = path.dirname(startDir) // Up a level, preventing `App/assets` getting returned
40
40
  const { root } = path.parse(dir)
41
41
  while (dir !== root) {
42
42
  const probe = path.join(dir, "Assets")
@@ -80,10 +80,17 @@ async function scanComponents(tarPath) {
80
80
  await tar.t({
81
81
  file: tarPath,
82
82
  onentry: (entry) => {
83
- const p = entry.path
83
+ const p = entry.path.replace(/\\/g, "/")
84
84
  if (!p.startsWith("comps/")) return
85
- const parts = p.split("/").filter(Boolean) // ["comps","button", ...]
86
- if (parts.length >= 2) comps.add(parts[1])
85
+
86
+ // Only treat entries inside a top-level folder under comps/
87
+ // e.g. "comps/button/**" → "button"
88
+ const rest = p.slice("comps/".length)
89
+ const firstSlash = rest.indexOf("/")
90
+ if (firstSlash === -1) return // file directly under comps/ → skip
91
+
92
+ const top = rest.slice(0, firstSlash)
93
+ if (top) comps.add(top)
87
94
  },
88
95
  })
89
96
  return comps
@@ -244,4 +251,4 @@ program
244
251
  program.parseAsync().catch((err) => {
245
252
  console.error(err)
246
253
  process.exit(1)
247
- })
254
+ })
package/dist/index.d.ts CHANGED
@@ -19,4 +19,7 @@ declare global {
19
19
  new (...args: any[]): T;
20
20
  }, count: number) => CS.System.Array;
21
21
  const toJsArray: <T>(csArr: CS.System.Array) => T[];
22
+ const toCsArray: <T>(jsArr: T[], type: {
23
+ new (...args: any[]): T;
24
+ }) => CS.System.Array;
22
25
  }
package/index.ts CHANGED
@@ -44,6 +44,7 @@ declare global {
44
44
  }
45
45
  const newCsArray: <T>(type: { new(...args: any[]): T }, count: number) => CS.System.Array
46
46
  const toJsArray: <T>(csArr: CS.System.Array) => T[]
47
+ const toCsArray: <T>(jsArr: T[], type: { new(...args: any[]): T }) => CS.System.Array
47
48
  }
48
49
 
49
50
  if (typeof globalThis.___document != "undefined") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "onejs-core",
3
3
  "description": "The JS part of OneJS, a UI framework and Scripting Engine for Unity.",
4
- "version": "2.0.21",
4
+ "version": "2.0.22",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/Singtaa/onejs-core"