@shapez-test/texture-packer 1.0.10 → 1.0.12

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.
Files changed (5) hide show
  1. package/index.d.ts +10 -1
  2. package/index.js +101 -82
  3. package/package.json +20 -75
  4. package/LICENSE +0 -21
  5. package/README.md +0 -87
package/index.d.ts CHANGED
@@ -1,3 +1,12 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
- export declare function plus100(input: number): number
3
+ export interface Config {
4
+ paddingX: number
5
+ paddingY: number
6
+ maxWidth: number
7
+ maxHeight: number
8
+ scale: Array<number>
9
+ scaleSuffix: Array<string>
10
+ }
11
+
12
+ export declare function hello(source: string, dest: string, name: string, config: Config): void
package/index.js CHANGED
@@ -3,9 +3,6 @@
3
3
  // @ts-nocheck
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- const { createRequire } = require('node:module')
7
- require = createRequire(__filename)
8
-
9
6
  const { readFileSync } = require('node:fs')
10
7
  let nativeBinding = null
11
8
  const loadErrors = []
@@ -73,15 +70,15 @@ function requireNative() {
73
70
  } else if (process.platform === 'android') {
74
71
  if (process.arch === 'arm64') {
75
72
  try {
76
- return require('./shapez-texture-packer.android-arm64.node')
73
+ return require('./texture-packer.android-arm64.node')
77
74
  } catch (e) {
78
75
  loadErrors.push(e)
79
76
  }
80
77
  try {
81
78
  const binding = require('@shapez-test/texture-packer-android-arm64')
82
79
  const bindingPackageVersion = require('@shapez-test/texture-packer-android-arm64/package.json').version
83
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
82
  }
86
83
  return binding
87
84
  } catch (e) {
@@ -89,15 +86,15 @@ function requireNative() {
89
86
  }
90
87
  } else if (process.arch === 'arm') {
91
88
  try {
92
- return require('./shapez-texture-packer.android-arm-eabi.node')
89
+ return require('./texture-packer.android-arm-eabi.node')
93
90
  } catch (e) {
94
91
  loadErrors.push(e)
95
92
  }
96
93
  try {
97
94
  const binding = require('@shapez-test/texture-packer-android-arm-eabi')
98
95
  const bindingPackageVersion = require('@shapez-test/texture-packer-android-arm-eabi/package.json').version
99
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
98
  }
102
99
  return binding
103
100
  } catch (e) {
@@ -108,32 +105,50 @@ function requireNative() {
108
105
  }
109
106
  } else if (process.platform === 'win32') {
110
107
  if (process.arch === 'x64') {
108
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
109
+ try {
110
+ return require('./texture-packer.win32-x64-gnu.node')
111
+ } catch (e) {
112
+ loadErrors.push(e)
113
+ }
111
114
  try {
112
- return require('./shapez-texture-packer.win32-x64-msvc.node')
115
+ const binding = require('@shapez-test/texture-packer-win32-x64-gnu')
116
+ const bindingPackageVersion = require('@shapez-test/texture-packer-win32-x64-gnu/package.json').version
117
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
+ }
120
+ return binding
121
+ } catch (e) {
122
+ loadErrors.push(e)
123
+ }
124
+ } else {
125
+ try {
126
+ return require('./texture-packer.win32-x64-msvc.node')
113
127
  } catch (e) {
114
128
  loadErrors.push(e)
115
129
  }
116
130
  try {
117
131
  const binding = require('@shapez-test/texture-packer-win32-x64-msvc')
118
132
  const bindingPackageVersion = require('@shapez-test/texture-packer-win32-x64-msvc/package.json').version
119
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
135
  }
122
136
  return binding
123
137
  } catch (e) {
124
138
  loadErrors.push(e)
125
139
  }
140
+ }
126
141
  } else if (process.arch === 'ia32') {
127
142
  try {
128
- return require('./shapez-texture-packer.win32-ia32-msvc.node')
143
+ return require('./texture-packer.win32-ia32-msvc.node')
129
144
  } catch (e) {
130
145
  loadErrors.push(e)
131
146
  }
132
147
  try {
133
148
  const binding = require('@shapez-test/texture-packer-win32-ia32-msvc')
134
149
  const bindingPackageVersion = require('@shapez-test/texture-packer-win32-ia32-msvc/package.json').version
135
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
152
  }
138
153
  return binding
139
154
  } catch (e) {
@@ -141,15 +156,15 @@ function requireNative() {
141
156
  }
142
157
  } else if (process.arch === 'arm64') {
143
158
  try {
144
- return require('./shapez-texture-packer.win32-arm64-msvc.node')
159
+ return require('./texture-packer.win32-arm64-msvc.node')
145
160
  } catch (e) {
146
161
  loadErrors.push(e)
147
162
  }
148
163
  try {
149
164
  const binding = require('@shapez-test/texture-packer-win32-arm64-msvc')
150
165
  const bindingPackageVersion = require('@shapez-test/texture-packer-win32-arm64-msvc/package.json').version
151
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
168
  }
154
169
  return binding
155
170
  } catch (e) {
@@ -160,15 +175,15 @@ function requireNative() {
160
175
  }
161
176
  } else if (process.platform === 'darwin') {
162
177
  try {
163
- return require('./shapez-texture-packer.darwin-universal.node')
178
+ return require('./texture-packer.darwin-universal.node')
164
179
  } catch (e) {
165
180
  loadErrors.push(e)
166
181
  }
167
182
  try {
168
183
  const binding = require('@shapez-test/texture-packer-darwin-universal')
169
184
  const bindingPackageVersion = require('@shapez-test/texture-packer-darwin-universal/package.json').version
170
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
187
  }
173
188
  return binding
174
189
  } catch (e) {
@@ -176,15 +191,15 @@ function requireNative() {
176
191
  }
177
192
  if (process.arch === 'x64') {
178
193
  try {
179
- return require('./shapez-texture-packer.darwin-x64.node')
194
+ return require('./texture-packer.darwin-x64.node')
180
195
  } catch (e) {
181
196
  loadErrors.push(e)
182
197
  }
183
198
  try {
184
199
  const binding = require('@shapez-test/texture-packer-darwin-x64')
185
200
  const bindingPackageVersion = require('@shapez-test/texture-packer-darwin-x64/package.json').version
186
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
203
  }
189
204
  return binding
190
205
  } catch (e) {
@@ -192,15 +207,15 @@ function requireNative() {
192
207
  }
193
208
  } else if (process.arch === 'arm64') {
194
209
  try {
195
- return require('./shapez-texture-packer.darwin-arm64.node')
210
+ return require('./texture-packer.darwin-arm64.node')
196
211
  } catch (e) {
197
212
  loadErrors.push(e)
198
213
  }
199
214
  try {
200
215
  const binding = require('@shapez-test/texture-packer-darwin-arm64')
201
216
  const bindingPackageVersion = require('@shapez-test/texture-packer-darwin-arm64/package.json').version
202
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
219
  }
205
220
  return binding
206
221
  } catch (e) {
@@ -212,15 +227,15 @@ function requireNative() {
212
227
  } else if (process.platform === 'freebsd') {
213
228
  if (process.arch === 'x64') {
214
229
  try {
215
- return require('./shapez-texture-packer.freebsd-x64.node')
230
+ return require('./texture-packer.freebsd-x64.node')
216
231
  } catch (e) {
217
232
  loadErrors.push(e)
218
233
  }
219
234
  try {
220
235
  const binding = require('@shapez-test/texture-packer-freebsd-x64')
221
236
  const bindingPackageVersion = require('@shapez-test/texture-packer-freebsd-x64/package.json').version
222
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
239
  }
225
240
  return binding
226
241
  } catch (e) {
@@ -228,15 +243,15 @@ function requireNative() {
228
243
  }
229
244
  } else if (process.arch === 'arm64') {
230
245
  try {
231
- return require('./shapez-texture-packer.freebsd-arm64.node')
246
+ return require('./texture-packer.freebsd-arm64.node')
232
247
  } catch (e) {
233
248
  loadErrors.push(e)
234
249
  }
235
250
  try {
236
251
  const binding = require('@shapez-test/texture-packer-freebsd-arm64')
237
252
  const bindingPackageVersion = require('@shapez-test/texture-packer-freebsd-arm64/package.json').version
238
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
255
  }
241
256
  return binding
242
257
  } catch (e) {
@@ -249,15 +264,15 @@ function requireNative() {
249
264
  if (process.arch === 'x64') {
250
265
  if (isMusl()) {
251
266
  try {
252
- return require('./shapez-texture-packer.linux-x64-musl.node')
267
+ return require('./texture-packer.linux-x64-musl.node')
253
268
  } catch (e) {
254
269
  loadErrors.push(e)
255
270
  }
256
271
  try {
257
272
  const binding = require('@shapez-test/texture-packer-linux-x64-musl')
258
273
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-x64-musl/package.json').version
259
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
261
276
  }
262
277
  return binding
263
278
  } catch (e) {
@@ -265,15 +280,15 @@ function requireNative() {
265
280
  }
266
281
  } else {
267
282
  try {
268
- return require('./shapez-texture-packer.linux-x64-gnu.node')
283
+ return require('./texture-packer.linux-x64-gnu.node')
269
284
  } catch (e) {
270
285
  loadErrors.push(e)
271
286
  }
272
287
  try {
273
288
  const binding = require('@shapez-test/texture-packer-linux-x64-gnu')
274
289
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-x64-gnu/package.json').version
275
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
292
  }
278
293
  return binding
279
294
  } catch (e) {
@@ -283,15 +298,15 @@ function requireNative() {
283
298
  } else if (process.arch === 'arm64') {
284
299
  if (isMusl()) {
285
300
  try {
286
- return require('./shapez-texture-packer.linux-arm64-musl.node')
301
+ return require('./texture-packer.linux-arm64-musl.node')
287
302
  } catch (e) {
288
303
  loadErrors.push(e)
289
304
  }
290
305
  try {
291
306
  const binding = require('@shapez-test/texture-packer-linux-arm64-musl')
292
307
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-arm64-musl/package.json').version
293
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
310
  }
296
311
  return binding
297
312
  } catch (e) {
@@ -299,15 +314,15 @@ function requireNative() {
299
314
  }
300
315
  } else {
301
316
  try {
302
- return require('./shapez-texture-packer.linux-arm64-gnu.node')
317
+ return require('./texture-packer.linux-arm64-gnu.node')
303
318
  } catch (e) {
304
319
  loadErrors.push(e)
305
320
  }
306
321
  try {
307
322
  const binding = require('@shapez-test/texture-packer-linux-arm64-gnu')
308
323
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-arm64-gnu/package.json').version
309
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
326
  }
312
327
  return binding
313
328
  } catch (e) {
@@ -317,15 +332,15 @@ function requireNative() {
317
332
  } else if (process.arch === 'arm') {
318
333
  if (isMusl()) {
319
334
  try {
320
- return require('./shapez-texture-packer.linux-arm-musleabihf.node')
335
+ return require('./texture-packer.linux-arm-musleabihf.node')
321
336
  } catch (e) {
322
337
  loadErrors.push(e)
323
338
  }
324
339
  try {
325
340
  const binding = require('@shapez-test/texture-packer-linux-arm-musleabihf')
326
341
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-arm-musleabihf/package.json').version
327
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
344
  }
330
345
  return binding
331
346
  } catch (e) {
@@ -333,15 +348,15 @@ function requireNative() {
333
348
  }
334
349
  } else {
335
350
  try {
336
- return require('./shapez-texture-packer.linux-arm-gnueabihf.node')
351
+ return require('./texture-packer.linux-arm-gnueabihf.node')
337
352
  } catch (e) {
338
353
  loadErrors.push(e)
339
354
  }
340
355
  try {
341
356
  const binding = require('@shapez-test/texture-packer-linux-arm-gnueabihf')
342
357
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-arm-gnueabihf/package.json').version
343
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
360
  }
346
361
  return binding
347
362
  } catch (e) {
@@ -351,15 +366,15 @@ function requireNative() {
351
366
  } else if (process.arch === 'loong64') {
352
367
  if (isMusl()) {
353
368
  try {
354
- return require('./shapez-texture-packer.linux-loong64-musl.node')
369
+ return require('./texture-packer.linux-loong64-musl.node')
355
370
  } catch (e) {
356
371
  loadErrors.push(e)
357
372
  }
358
373
  try {
359
374
  const binding = require('@shapez-test/texture-packer-linux-loong64-musl')
360
375
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-loong64-musl/package.json').version
361
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
378
  }
364
379
  return binding
365
380
  } catch (e) {
@@ -367,15 +382,15 @@ function requireNative() {
367
382
  }
368
383
  } else {
369
384
  try {
370
- return require('./shapez-texture-packer.linux-loong64-gnu.node')
385
+ return require('./texture-packer.linux-loong64-gnu.node')
371
386
  } catch (e) {
372
387
  loadErrors.push(e)
373
388
  }
374
389
  try {
375
390
  const binding = require('@shapez-test/texture-packer-linux-loong64-gnu')
376
391
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-loong64-gnu/package.json').version
377
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
379
394
  }
380
395
  return binding
381
396
  } catch (e) {
@@ -385,15 +400,15 @@ function requireNative() {
385
400
  } else if (process.arch === 'riscv64') {
386
401
  if (isMusl()) {
387
402
  try {
388
- return require('./shapez-texture-packer.linux-riscv64-musl.node')
403
+ return require('./texture-packer.linux-riscv64-musl.node')
389
404
  } catch (e) {
390
405
  loadErrors.push(e)
391
406
  }
392
407
  try {
393
408
  const binding = require('@shapez-test/texture-packer-linux-riscv64-musl')
394
409
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-riscv64-musl/package.json').version
395
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
412
  }
398
413
  return binding
399
414
  } catch (e) {
@@ -401,15 +416,15 @@ function requireNative() {
401
416
  }
402
417
  } else {
403
418
  try {
404
- return require('./shapez-texture-packer.linux-riscv64-gnu.node')
419
+ return require('./texture-packer.linux-riscv64-gnu.node')
405
420
  } catch (e) {
406
421
  loadErrors.push(e)
407
422
  }
408
423
  try {
409
424
  const binding = require('@shapez-test/texture-packer-linux-riscv64-gnu')
410
425
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-riscv64-gnu/package.json').version
411
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
413
428
  }
414
429
  return binding
415
430
  } catch (e) {
@@ -418,15 +433,15 @@ function requireNative() {
418
433
  }
419
434
  } else if (process.arch === 'ppc64') {
420
435
  try {
421
- return require('./shapez-texture-packer.linux-ppc64-gnu.node')
436
+ return require('./texture-packer.linux-ppc64-gnu.node')
422
437
  } catch (e) {
423
438
  loadErrors.push(e)
424
439
  }
425
440
  try {
426
441
  const binding = require('@shapez-test/texture-packer-linux-ppc64-gnu')
427
442
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-ppc64-gnu/package.json').version
428
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
429
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
430
445
  }
431
446
  return binding
432
447
  } catch (e) {
@@ -434,15 +449,15 @@ function requireNative() {
434
449
  }
435
450
  } else if (process.arch === 's390x') {
436
451
  try {
437
- return require('./shapez-texture-packer.linux-s390x-gnu.node')
452
+ return require('./texture-packer.linux-s390x-gnu.node')
438
453
  } catch (e) {
439
454
  loadErrors.push(e)
440
455
  }
441
456
  try {
442
457
  const binding = require('@shapez-test/texture-packer-linux-s390x-gnu')
443
458
  const bindingPackageVersion = require('@shapez-test/texture-packer-linux-s390x-gnu/package.json').version
444
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
445
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
446
461
  }
447
462
  return binding
448
463
  } catch (e) {
@@ -454,15 +469,15 @@ function requireNative() {
454
469
  } else if (process.platform === 'openharmony') {
455
470
  if (process.arch === 'arm64') {
456
471
  try {
457
- return require('./shapez-texture-packer.openharmony-arm64.node')
472
+ return require('./texture-packer.openharmony-arm64.node')
458
473
  } catch (e) {
459
474
  loadErrors.push(e)
460
475
  }
461
476
  try {
462
477
  const binding = require('@shapez-test/texture-packer-openharmony-arm64')
463
478
  const bindingPackageVersion = require('@shapez-test/texture-packer-openharmony-arm64/package.json').version
464
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
465
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
466
481
  }
467
482
  return binding
468
483
  } catch (e) {
@@ -470,15 +485,15 @@ function requireNative() {
470
485
  }
471
486
  } else if (process.arch === 'x64') {
472
487
  try {
473
- return require('./shapez-texture-packer.openharmony-x64.node')
488
+ return require('./texture-packer.openharmony-x64.node')
474
489
  } catch (e) {
475
490
  loadErrors.push(e)
476
491
  }
477
492
  try {
478
493
  const binding = require('@shapez-test/texture-packer-openharmony-x64')
479
494
  const bindingPackageVersion = require('@shapez-test/texture-packer-openharmony-x64/package.json').version
480
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
481
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
482
497
  }
483
498
  return binding
484
499
  } catch (e) {
@@ -486,15 +501,15 @@ function requireNative() {
486
501
  }
487
502
  } else if (process.arch === 'arm') {
488
503
  try {
489
- return require('./shapez-texture-packer.openharmony-arm.node')
504
+ return require('./texture-packer.openharmony-arm.node')
490
505
  } catch (e) {
491
506
  loadErrors.push(e)
492
507
  }
493
508
  try {
494
509
  const binding = require('@shapez-test/texture-packer-openharmony-arm')
495
510
  const bindingPackageVersion = require('@shapez-test/texture-packer-openharmony-arm/package.json').version
496
- if (bindingPackageVersion !== '1.0.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
497
- throw new Error(`Native binding package version mismatch, expected 1.0.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '1.0.12' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 1.0.12 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
498
513
  }
499
514
  return binding
500
515
  } catch (e) {
@@ -514,20 +529,24 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
514
529
  let wasiBinding = null
515
530
  let wasiBindingError = null
516
531
  try {
517
- wasiBinding = require('./shapez-texture-packer.wasi.cjs')
532
+ wasiBinding = require('./texture-packer.wasi.cjs')
518
533
  nativeBinding = wasiBinding
519
534
  } catch (err) {
520
535
  if (process.env.NAPI_RS_FORCE_WASI) {
521
536
  wasiBindingError = err
522
537
  }
523
538
  }
524
- if (!nativeBinding) {
539
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
525
540
  try {
526
541
  wasiBinding = require('@shapez-test/texture-packer-wasm32-wasi')
527
542
  nativeBinding = wasiBinding
528
543
  } catch (err) {
529
544
  if (process.env.NAPI_RS_FORCE_WASI) {
530
- wasiBindingError.cause = err
545
+ if (!wasiBindingError) {
546
+ wasiBindingError = err
547
+ } else {
548
+ wasiBindingError.cause = err
549
+ }
531
550
  loadErrors.push(err)
532
551
  }
533
552
  }
@@ -557,4 +576,4 @@ if (!nativeBinding) {
557
576
  }
558
577
 
559
578
  module.exports = nativeBinding
560
- module.exports.plus100 = nativeBinding.plus100
579
+ module.exports.hello = nativeBinding.hello
package/package.json CHANGED
@@ -1,26 +1,20 @@
1
1
  {
2
2
  "name": "@shapez-test/texture-packer",
3
- "version": "1.0.10",
4
- "description": "Template project for writing node package with napi-rs",
3
+ "version": "1.0.12",
5
4
  "main": "index.js",
6
- "repository": "https://github.com/MathieuMatiques/napi-testing",
7
- "license": "no",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+ssh://git@github.com/MathieuMatiques/shapez-texture-packer.git"
8
+ },
9
+ "license": "GPL3",
8
10
  "browser": "browser.js",
9
- "keywords": [
10
- "napi-rs",
11
- "NAPI",
12
- "N-API",
13
- "Rust",
14
- "node-addon",
15
- "node-addon-api"
16
- ],
17
11
  "files": [
18
12
  "index.d.ts",
19
13
  "index.js",
20
14
  "browser.js"
21
15
  ],
22
16
  "napi": {
23
- "binaryName": "shapez-texture-packer",
17
+ "binaryName": "texture-packer",
24
18
  "targets": [
25
19
  "x86_64-pc-windows-msvc",
26
20
  "x86_64-apple-darwin",
@@ -40,79 +34,30 @@
40
34
  "access": "public"
41
35
  },
42
36
  "scripts": {
43
- "artifacts": "napi artifacts",
44
- "bench": "node --import @oxc-node/core/register benchmark/bench.ts",
45
- "build": "napi build --platform --release",
46
- "build:debug": "napi build --platform",
47
- "format": "run-p format:prettier format:rs format:toml",
48
- "format:prettier": "prettier . -w",
49
- "format:toml": "taplo format",
50
- "format:rs": "cargo fmt",
51
- "lint": "oxlint .",
37
+ "artifacts": "bunx napi artifacts",
38
+ "build": "bunx napi build --platform --release",
39
+ "build:debug": "bunx napi build --platform",
52
40
  "prepublishOnly": "napi prepublish -t npm",
53
- "test": "ava",
54
- "preversion": "napi build --platform && git add .",
55
- "version": "napi version",
56
- "prepare": "husky"
41
+ "version": "napi build --platform && git add ."
57
42
  },
58
43
  "devDependencies": {
59
44
  "@emnapi/core": "^1.5.0",
60
45
  "@emnapi/runtime": "^1.5.0",
61
46
  "@napi-rs/cli": "^3.2.0",
62
47
  "@oxc-node/core": "^0.0.35",
63
- "@taplo/cli": "^0.7.0",
64
48
  "@tybys/wasm-util": "^0.10.0",
65
- "ava": "^6.4.1",
66
49
  "chalk": "^5.6.2",
67
- "husky": "^9.1.7",
68
- "lint-staged": "^16.1.6",
69
- "npm-run-all2": "^8.0.4",
70
- "oxlint": "^1.14.0",
71
- "prettier": "^3.6.2",
72
- "tinybench": "^6.0.0",
73
50
  "typescript": "^5.9.2"
74
51
  },
75
- "lint-staged": {
76
- "*.@(js|ts|tsx)": [
77
- "oxlint --fix"
78
- ],
79
- "*.@(js|ts|tsx|yml|yaml|md|json)": [
80
- "prettier --write"
81
- ],
82
- "*.toml": [
83
- "taplo format"
84
- ]
85
- },
86
- "ava": {
87
- "extensions": {
88
- "ts": "module"
89
- },
90
- "timeout": "2m",
91
- "workerThreads": false,
92
- "environmentVariables": {
93
- "OXC_TSCONFIG_PATH": "./__test__/tsconfig.json"
94
- },
95
- "nodeArguments": [
96
- "--import",
97
- "@oxc-node/core/register"
98
- ]
99
- },
100
- "prettier": {
101
- "printWidth": 120,
102
- "semi": false,
103
- "trailingComma": "all",
104
- "singleQuote": true,
105
- "arrowParens": "always"
106
- },
107
- "packageManager": "yarn@4.12.0",
52
+ "type": "module",
108
53
  "optionalDependencies": {
109
- "@shapez-test/texture-packer-win32-x64-msvc": "1.0.10",
110
- "@shapez-test/texture-packer-darwin-x64": "1.0.10",
111
- "@shapez-test/texture-packer-linux-x64-gnu": "1.0.10",
112
- "@shapez-test/texture-packer-linux-x64-musl": "1.0.10",
113
- "@shapez-test/texture-packer-linux-arm64-gnu": "1.0.10",
114
- "@shapez-test/texture-packer-darwin-arm64": "1.0.10",
115
- "@shapez-test/texture-packer-linux-arm64-musl": "1.0.10",
116
- "@shapez-test/texture-packer-win32-arm64-msvc": "1.0.10"
54
+ "@shapez-test/texture-packer-win32-x64-msvc": "1.0.12",
55
+ "@shapez-test/texture-packer-darwin-x64": "1.0.12",
56
+ "@shapez-test/texture-packer-linux-x64-gnu": "1.0.12",
57
+ "@shapez-test/texture-packer-linux-x64-musl": "1.0.12",
58
+ "@shapez-test/texture-packer-linux-arm64-gnu": "1.0.12",
59
+ "@shapez-test/texture-packer-darwin-arm64": "1.0.12",
60
+ "@shapez-test/texture-packer-linux-arm64-musl": "1.0.12",
61
+ "@shapez-test/texture-packer-win32-arm64-msvc": "1.0.12"
117
62
  }
118
63
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 N-API for Rust
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/README.md DELETED
@@ -1,87 +0,0 @@
1
- # `@napi-rs/package-template`
2
-
3
- ![https://github.com/napi-rs/package-template/actions](https://github.com/napi-rs/package-template/workflows/CI/badge.svg)
4
-
5
- > Template project for writing node packages with napi-rs.
6
-
7
- # Usage
8
-
9
- 1. Click **Use this template**.
10
- 2. **Clone** your project.
11
- 3. Run `yarn install` to install dependencies.
12
- 4. Run `yarn napi rename -n [@your-scope/package-name] -b [binary-name]` command under the project folder to rename your package.
13
-
14
- ## Install this test package
15
-
16
- ```bash
17
- yarn add @napi-rs/package-template
18
- ```
19
-
20
- ## Ability
21
-
22
- ### Build
23
-
24
- After `yarn build/npm run build` command, you can see `package-template.[darwin|win32|linux].node` file in project root. This is the native addon built from [lib.rs](./src/lib.rs).
25
-
26
- ### Test
27
-
28
- With [ava](https://github.com/avajs/ava), run `yarn test/npm run test` to testing native addon. You can also switch to another testing framework if you want.
29
-
30
- ### CI
31
-
32
- With GitHub Actions, each commit and pull request will be built and tested automatically in [`node@20`, `@node22`] x [`macOS`, `Linux`, `Windows`] matrix. You will never be afraid of the native addon broken in these platforms.
33
-
34
- ### Release
35
-
36
- Release native package is very difficult in old days. Native packages may ask developers who use it to install `build toolchain` like `gcc/llvm`, `node-gyp` or something more.
37
-
38
- With `GitHub actions`, we can easily prebuild a `binary` for major platforms. And with `N-API`, we should never be afraid of **ABI Compatible**.
39
-
40
- The other problem is how to deliver prebuild `binary` to users. Downloading it in `postinstall` script is a common way that most packages do it right now. The problem with this solution is it introduced many other packages to download binary that has not been used by `runtime codes`. The other problem is some users may not easily download the binary from `GitHub/CDN` if they are behind a private network (But in most cases, they have a private NPM mirror).
41
-
42
- In this package, we choose a better way to solve this problem. We release different `npm packages` for different platforms. And add it to `optionalDependencies` before releasing the `Major` package to npm.
43
-
44
- `NPM` will choose which native package should download from `registry` automatically. You can see [npm](./npm) dir for details. And you can also run `yarn add @napi-rs/package-template` to see how it works.
45
-
46
- ## Develop requirements
47
-
48
- - Install the latest `Rust`
49
- - Install `Node.js@10+` which fully supported `Node-API`
50
- - Install `yarn@1.x`
51
-
52
- ## Test in local
53
-
54
- - yarn
55
- - yarn build
56
- - yarn test
57
-
58
- And you will see:
59
-
60
- ```bash
61
- $ ava --verbose
62
-
63
- ✔ sync function from native code
64
- ✔ sleep function from native code (201ms)
65
-
66
-
67
- 2 tests passed
68
- ✨ Done in 1.12s.
69
- ```
70
-
71
- ## Release package
72
-
73
- Ensure you have set your **NPM_TOKEN** in the `GitHub` project setting.
74
-
75
- In `Settings -> Secrets`, add **NPM_TOKEN** into it.
76
-
77
- When you want to release the package:
78
-
79
- ```bash
80
- npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]
81
-
82
- git push
83
- ```
84
-
85
- GitHub actions will do the rest job for you.
86
-
87
- > WARN: Don't run `npm publish` manually.