@richardmcquiston01/unofficial-xcs-writer 0.1.0
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/README.md +97 -0
- package/dist/index.cjs +83 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +25 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# unofficial-xcs-writer
|
|
2
|
+
|
|
3
|
+
A framework-agnostic TypeScript library for reading, writing, and applying variable substitution to `.xcs` files produced by [xTool Creative Space](https://www.xtool.com/pages/software). Not affiliated with xTool.
|
|
4
|
+
|
|
5
|
+
## What is an XCS file?
|
|
6
|
+
|
|
7
|
+
An `.xcs` file is a plain UTF-8 JSON document exported by xTool Creative Space. It describes a laser project — canvas dimensions, design objects (shapes, text, images), layer assignments, and device parameters. This library lets you:
|
|
8
|
+
|
|
9
|
+
- **Read** an XCS file and inspect its contents
|
|
10
|
+
- **Extract** `{{token}}` template placeholders from text objects
|
|
11
|
+
- **Render** a filled-in copy by substituting values for those placeholders
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @richardmcquiston01/unofficial-xcs-writer
|
|
17
|
+
# or
|
|
18
|
+
pnpm add @richardmcquiston01/unofficial-xcs-writer
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { assertXcsFormat, extractXcsTokens, renderXcsFile } from '@richardmcquiston01/unofficial-xcs-writer';
|
|
25
|
+
import type { XcsVariable } from '@richardmcquiston01/unofficial-xcs-writer';
|
|
26
|
+
|
|
27
|
+
// Load an .xcs file as an ArrayBuffer (browser or Node.js)
|
|
28
|
+
const buffer = await fetch('/templates/name-tag.xcs').then(r => r.arrayBuffer());
|
|
29
|
+
|
|
30
|
+
// Validate it's a real XCS file
|
|
31
|
+
assertXcsFormat(buffer); // throws if invalid
|
|
32
|
+
|
|
33
|
+
// Discover which {{token}} placeholders are in the file
|
|
34
|
+
const tokens = extractXcsTokens(buffer);
|
|
35
|
+
// e.g. ['FirstName', 'LastName']
|
|
36
|
+
|
|
37
|
+
// Define variables and supply values
|
|
38
|
+
const variables: XcsVariable[] = [
|
|
39
|
+
{ token: 'FirstName', defaultValue: 'Guest' },
|
|
40
|
+
{ token: 'LastName' },
|
|
41
|
+
];
|
|
42
|
+
const values = { FirstName: 'Jane', LastName: 'Smith' };
|
|
43
|
+
|
|
44
|
+
// Produce a filled-in .xcs file ready for download
|
|
45
|
+
const output: Uint8Array = renderXcsFile(buffer, variables, values);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
### `assertXcsFormat(buffer: ArrayBuffer): void`
|
|
51
|
+
|
|
52
|
+
Validates that `buffer` is a parseable XCS JSON file containing a `canvas` array. Throws a descriptive error if the file is invalid or unrecognized.
|
|
53
|
+
|
|
54
|
+
### `readXcsFile(buffer: ArrayBuffer): string`
|
|
55
|
+
|
|
56
|
+
Decodes the buffer and returns the raw JSON string. Useful for inspection or pass-through scenarios.
|
|
57
|
+
|
|
58
|
+
### `extractXcsTokens(buffer: ArrayBuffer): string[]`
|
|
59
|
+
|
|
60
|
+
Scans all `TEXT` display objects across all canvases and returns the unique token names found (without braces). For example, `{{LastName}}` in the file → `"LastName"` in the returned array.
|
|
61
|
+
|
|
62
|
+
### `renderXcsFile(buffer, variables, values): Uint8Array`
|
|
63
|
+
|
|
64
|
+
Applies substitution to every `TEXT` display object and returns the modified file encoded as a UTF-8 `Uint8Array`. Tokens with no matching entry in `values` fall back to `variable.defaultValue`, or an empty string if no default is set.
|
|
65
|
+
|
|
66
|
+
### `XcsVariable`
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
interface XcsVariable {
|
|
70
|
+
token: string; // token name without braces, e.g. "LastName"
|
|
71
|
+
defaultValue?: string;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pnpm install # install dev dependencies
|
|
79
|
+
pnpm build # compile → dist/ (ESM + CJS + .d.ts)
|
|
80
|
+
pnpm dev # watch mode — rebuilds on save
|
|
81
|
+
pnpm test # run tests with vitest
|
|
82
|
+
npx tsc --noEmit # type-check without emitting
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Output files after `pnpm build`:
|
|
86
|
+
|
|
87
|
+
| File | Format |
|
|
88
|
+
|------|--------|
|
|
89
|
+
| `dist/index.js` | ESM |
|
|
90
|
+
| `dist/index.cjs` | CommonJS |
|
|
91
|
+
| `dist/index.d.ts` | TypeScript declarations |
|
|
92
|
+
|
|
93
|
+
## Notes
|
|
94
|
+
|
|
95
|
+
- All inputs and outputs use plain browser-compatible types (`ArrayBuffer`, `Uint8Array`, `string`) — no Node.js APIs, no DOM, no framework required.
|
|
96
|
+
- Only `TEXT` display objects are modified during substitution. Geometry, bitmaps, device configuration, and all other fields pass through unchanged.
|
|
97
|
+
- This library targets the current xTool Creative Space JSON format. Older versions of the software may export a different structure.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
assertXcsFormat: () => assertXcsFormat,
|
|
24
|
+
extractXcsTokens: () => extractXcsTokens,
|
|
25
|
+
readXcsFile: () => readXcsFile,
|
|
26
|
+
renderXcsFile: () => renderXcsFile
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
|
|
30
|
+
// src/xcs.ts
|
|
31
|
+
var TOKEN_RE = /\{\{([^}]+)\}\}/g;
|
|
32
|
+
function assertXcsFormat(buffer) {
|
|
33
|
+
let project;
|
|
34
|
+
try {
|
|
35
|
+
project = JSON.parse(new TextDecoder().decode(buffer));
|
|
36
|
+
} catch (err) {
|
|
37
|
+
throw new Error(`Not a valid .xcs file: ${err.message}`);
|
|
38
|
+
}
|
|
39
|
+
if (typeof project !== "object" || project === null || !Array.isArray(project.canvas)) {
|
|
40
|
+
throw new Error("Not a valid .xcs file: missing canvas array.");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function readXcsFile(buffer) {
|
|
44
|
+
return new TextDecoder().decode(buffer);
|
|
45
|
+
}
|
|
46
|
+
function extractXcsTokens(buffer) {
|
|
47
|
+
const project = JSON.parse(readXcsFile(buffer));
|
|
48
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49
|
+
for (const canvas of project.canvas) {
|
|
50
|
+
for (const display of canvas.displays) {
|
|
51
|
+
if (display.type === "TEXT" && typeof display.text === "string") {
|
|
52
|
+
for (const match of display.text.matchAll(TOKEN_RE)) {
|
|
53
|
+
seen.add(match[1]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return Array.from(seen);
|
|
59
|
+
}
|
|
60
|
+
function renderXcsFile(buffer, variables, values) {
|
|
61
|
+
const project = JSON.parse(readXcsFile(buffer));
|
|
62
|
+
for (const canvas of project.canvas) {
|
|
63
|
+
for (const display of canvas.displays) {
|
|
64
|
+
if (display.type === "TEXT" && typeof display.text === "string") {
|
|
65
|
+
let text = display.text;
|
|
66
|
+
for (const variable of variables) {
|
|
67
|
+
const replacement = values[variable.token] ?? variable.defaultValue ?? "";
|
|
68
|
+
text = text.replaceAll(`{{${variable.token}}}`, replacement);
|
|
69
|
+
}
|
|
70
|
+
display.text = text;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return new TextEncoder().encode(JSON.stringify(project));
|
|
75
|
+
}
|
|
76
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
+
0 && (module.exports = {
|
|
78
|
+
assertXcsFormat,
|
|
79
|
+
extractXcsTokens,
|
|
80
|
+
readXcsFile,
|
|
81
|
+
renderXcsFile
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/xcs.ts"],"sourcesContent":["export type { XcsVariable, XcsProject, XcsCanvas, XcsDisplay } from './types.js';\nexport { assertXcsFormat, readXcsFile, extractXcsTokens, renderXcsFile } from './xcs.js';\n","import type { XcsProject, XcsVariable } from './types.js';\n\nconst TOKEN_RE = /\\{\\{([^}]+)\\}\\}/g;\n\nexport function assertXcsFormat(buffer: ArrayBuffer): void {\n let project: unknown;\n try {\n project = JSON.parse(new TextDecoder().decode(buffer));\n } catch (err) {\n throw new Error(`Not a valid .xcs file: ${(err as Error).message}`);\n }\n if (\n typeof project !== 'object' ||\n project === null ||\n !Array.isArray((project as Record<string, unknown>).canvas)\n ) {\n throw new Error('Not a valid .xcs file: missing canvas array.');\n }\n}\n\nexport function readXcsFile(buffer: ArrayBuffer): string {\n return new TextDecoder().decode(buffer);\n}\n\nexport function extractXcsTokens(buffer: ArrayBuffer): string[] {\n const project = JSON.parse(readXcsFile(buffer)) as XcsProject;\n const seen = new Set<string>();\n\n for (const canvas of project.canvas) {\n for (const display of canvas.displays) {\n if (display.type === 'TEXT' && typeof display.text === 'string') {\n for (const match of display.text.matchAll(TOKEN_RE)) {\n seen.add(match[1]);\n }\n }\n }\n }\n\n return Array.from(seen);\n}\n\nexport function renderXcsFile(\n buffer: ArrayBuffer,\n variables: XcsVariable[],\n values: Record<string, string>,\n): Uint8Array {\n const project = JSON.parse(readXcsFile(buffer)) as XcsProject;\n\n for (const canvas of project.canvas) {\n for (const display of canvas.displays) {\n if (display.type === 'TEXT' && typeof display.text === 'string') {\n let text = display.text;\n for (const variable of variables) {\n const replacement = values[variable.token] ?? variable.defaultValue ?? '';\n text = text.replaceAll(`{{${variable.token}}}`, replacement);\n }\n display.text = text;\n }\n }\n }\n\n return new TextEncoder().encode(JSON.stringify(project));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,WAAW;AAEV,SAAS,gBAAgB,QAA2B;AACzD,MAAI;AACJ,MAAI;AACF,cAAU,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,MAAM,CAAC;AAAA,EACvD,SAAS,KAAK;AACZ,UAAM,IAAI,MAAM,0BAA2B,IAAc,OAAO,EAAE;AAAA,EACpE;AACA,MACE,OAAO,YAAY,YACnB,YAAY,QACZ,CAAC,MAAM,QAAS,QAAoC,MAAM,GAC1D;AACA,UAAM,IAAI,MAAM,8CAA8C;AAAA,EAChE;AACF;AAEO,SAAS,YAAY,QAA6B;AACvD,SAAO,IAAI,YAAY,EAAE,OAAO,MAAM;AACxC;AAEO,SAAS,iBAAiB,QAA+B;AAC9D,QAAM,UAAU,KAAK,MAAM,YAAY,MAAM,CAAC;AAC9C,QAAM,OAAO,oBAAI,IAAY;AAE7B,aAAW,UAAU,QAAQ,QAAQ;AACnC,eAAW,WAAW,OAAO,UAAU;AACrC,UAAI,QAAQ,SAAS,UAAU,OAAO,QAAQ,SAAS,UAAU;AAC/D,mBAAW,SAAS,QAAQ,KAAK,SAAS,QAAQ,GAAG;AACnD,eAAK,IAAI,MAAM,CAAC,CAAC;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;AAEO,SAAS,cACd,QACA,WACA,QACY;AACZ,QAAM,UAAU,KAAK,MAAM,YAAY,MAAM,CAAC;AAE9C,aAAW,UAAU,QAAQ,QAAQ;AACnC,eAAW,WAAW,OAAO,UAAU;AACrC,UAAI,QAAQ,SAAS,UAAU,OAAO,QAAQ,SAAS,UAAU;AAC/D,YAAI,OAAO,QAAQ;AACnB,mBAAW,YAAY,WAAW;AAChC,gBAAM,cAAc,OAAO,SAAS,KAAK,KAAK,SAAS,gBAAgB;AACvE,iBAAO,KAAK,WAAW,KAAK,SAAS,KAAK,MAAM,WAAW;AAAA,QAC7D;AACA,gBAAQ,OAAO;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AAEA,SAAO,IAAI,YAAY,EAAE,OAAO,KAAK,UAAU,OAAO,CAAC;AACzD;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface XcsVariable {
|
|
2
|
+
token: string;
|
|
3
|
+
defaultValue?: string;
|
|
4
|
+
}
|
|
5
|
+
interface XcsDisplay {
|
|
6
|
+
type: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface XcsCanvas {
|
|
11
|
+
displays: XcsDisplay[];
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
interface XcsProject {
|
|
15
|
+
canvasId: string;
|
|
16
|
+
canvas: XcsCanvas[];
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare function assertXcsFormat(buffer: ArrayBuffer): void;
|
|
21
|
+
declare function readXcsFile(buffer: ArrayBuffer): string;
|
|
22
|
+
declare function extractXcsTokens(buffer: ArrayBuffer): string[];
|
|
23
|
+
declare function renderXcsFile(buffer: ArrayBuffer, variables: XcsVariable[], values: Record<string, string>): Uint8Array;
|
|
24
|
+
|
|
25
|
+
export { type XcsCanvas, type XcsDisplay, type XcsProject, type XcsVariable, assertXcsFormat, extractXcsTokens, readXcsFile, renderXcsFile };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface XcsVariable {
|
|
2
|
+
token: string;
|
|
3
|
+
defaultValue?: string;
|
|
4
|
+
}
|
|
5
|
+
interface XcsDisplay {
|
|
6
|
+
type: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
interface XcsCanvas {
|
|
11
|
+
displays: XcsDisplay[];
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
interface XcsProject {
|
|
15
|
+
canvasId: string;
|
|
16
|
+
canvas: XcsCanvas[];
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare function assertXcsFormat(buffer: ArrayBuffer): void;
|
|
21
|
+
declare function readXcsFile(buffer: ArrayBuffer): string;
|
|
22
|
+
declare function extractXcsTokens(buffer: ArrayBuffer): string[];
|
|
23
|
+
declare function renderXcsFile(buffer: ArrayBuffer, variables: XcsVariable[], values: Record<string, string>): Uint8Array;
|
|
24
|
+
|
|
25
|
+
export { type XcsCanvas, type XcsDisplay, type XcsProject, type XcsVariable, assertXcsFormat, extractXcsTokens, readXcsFile, renderXcsFile };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/xcs.ts
|
|
2
|
+
var TOKEN_RE = /\{\{([^}]+)\}\}/g;
|
|
3
|
+
function assertXcsFormat(buffer) {
|
|
4
|
+
let project;
|
|
5
|
+
try {
|
|
6
|
+
project = JSON.parse(new TextDecoder().decode(buffer));
|
|
7
|
+
} catch (err) {
|
|
8
|
+
throw new Error(`Not a valid .xcs file: ${err.message}`);
|
|
9
|
+
}
|
|
10
|
+
if (typeof project !== "object" || project === null || !Array.isArray(project.canvas)) {
|
|
11
|
+
throw new Error("Not a valid .xcs file: missing canvas array.");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function readXcsFile(buffer) {
|
|
15
|
+
return new TextDecoder().decode(buffer);
|
|
16
|
+
}
|
|
17
|
+
function extractXcsTokens(buffer) {
|
|
18
|
+
const project = JSON.parse(readXcsFile(buffer));
|
|
19
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20
|
+
for (const canvas of project.canvas) {
|
|
21
|
+
for (const display of canvas.displays) {
|
|
22
|
+
if (display.type === "TEXT" && typeof display.text === "string") {
|
|
23
|
+
for (const match of display.text.matchAll(TOKEN_RE)) {
|
|
24
|
+
seen.add(match[1]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return Array.from(seen);
|
|
30
|
+
}
|
|
31
|
+
function renderXcsFile(buffer, variables, values) {
|
|
32
|
+
const project = JSON.parse(readXcsFile(buffer));
|
|
33
|
+
for (const canvas of project.canvas) {
|
|
34
|
+
for (const display of canvas.displays) {
|
|
35
|
+
if (display.type === "TEXT" && typeof display.text === "string") {
|
|
36
|
+
let text = display.text;
|
|
37
|
+
for (const variable of variables) {
|
|
38
|
+
const replacement = values[variable.token] ?? variable.defaultValue ?? "";
|
|
39
|
+
text = text.replaceAll(`{{${variable.token}}}`, replacement);
|
|
40
|
+
}
|
|
41
|
+
display.text = text;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return new TextEncoder().encode(JSON.stringify(project));
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
assertXcsFormat,
|
|
49
|
+
extractXcsTokens,
|
|
50
|
+
readXcsFile,
|
|
51
|
+
renderXcsFile
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/xcs.ts"],"sourcesContent":["import type { XcsProject, XcsVariable } from './types.js';\n\nconst TOKEN_RE = /\\{\\{([^}]+)\\}\\}/g;\n\nexport function assertXcsFormat(buffer: ArrayBuffer): void {\n let project: unknown;\n try {\n project = JSON.parse(new TextDecoder().decode(buffer));\n } catch (err) {\n throw new Error(`Not a valid .xcs file: ${(err as Error).message}`);\n }\n if (\n typeof project !== 'object' ||\n project === null ||\n !Array.isArray((project as Record<string, unknown>).canvas)\n ) {\n throw new Error('Not a valid .xcs file: missing canvas array.');\n }\n}\n\nexport function readXcsFile(buffer: ArrayBuffer): string {\n return new TextDecoder().decode(buffer);\n}\n\nexport function extractXcsTokens(buffer: ArrayBuffer): string[] {\n const project = JSON.parse(readXcsFile(buffer)) as XcsProject;\n const seen = new Set<string>();\n\n for (const canvas of project.canvas) {\n for (const display of canvas.displays) {\n if (display.type === 'TEXT' && typeof display.text === 'string') {\n for (const match of display.text.matchAll(TOKEN_RE)) {\n seen.add(match[1]);\n }\n }\n }\n }\n\n return Array.from(seen);\n}\n\nexport function renderXcsFile(\n buffer: ArrayBuffer,\n variables: XcsVariable[],\n values: Record<string, string>,\n): Uint8Array {\n const project = JSON.parse(readXcsFile(buffer)) as XcsProject;\n\n for (const canvas of project.canvas) {\n for (const display of canvas.displays) {\n if (display.type === 'TEXT' && typeof display.text === 'string') {\n let text = display.text;\n for (const variable of variables) {\n const replacement = values[variable.token] ?? variable.defaultValue ?? '';\n text = text.replaceAll(`{{${variable.token}}}`, replacement);\n }\n display.text = text;\n }\n }\n }\n\n return new TextEncoder().encode(JSON.stringify(project));\n}\n"],"mappings":";AAEA,IAAM,WAAW;AAEV,SAAS,gBAAgB,QAA2B;AACzD,MAAI;AACJ,MAAI;AACF,cAAU,KAAK,MAAM,IAAI,YAAY,EAAE,OAAO,MAAM,CAAC;AAAA,EACvD,SAAS,KAAK;AACZ,UAAM,IAAI,MAAM,0BAA2B,IAAc,OAAO,EAAE;AAAA,EACpE;AACA,MACE,OAAO,YAAY,YACnB,YAAY,QACZ,CAAC,MAAM,QAAS,QAAoC,MAAM,GAC1D;AACA,UAAM,IAAI,MAAM,8CAA8C;AAAA,EAChE;AACF;AAEO,SAAS,YAAY,QAA6B;AACvD,SAAO,IAAI,YAAY,EAAE,OAAO,MAAM;AACxC;AAEO,SAAS,iBAAiB,QAA+B;AAC9D,QAAM,UAAU,KAAK,MAAM,YAAY,MAAM,CAAC;AAC9C,QAAM,OAAO,oBAAI,IAAY;AAE7B,aAAW,UAAU,QAAQ,QAAQ;AACnC,eAAW,WAAW,OAAO,UAAU;AACrC,UAAI,QAAQ,SAAS,UAAU,OAAO,QAAQ,SAAS,UAAU;AAC/D,mBAAW,SAAS,QAAQ,KAAK,SAAS,QAAQ,GAAG;AACnD,eAAK,IAAI,MAAM,CAAC,CAAC;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;AAEO,SAAS,cACd,QACA,WACA,QACY;AACZ,QAAM,UAAU,KAAK,MAAM,YAAY,MAAM,CAAC;AAE9C,aAAW,UAAU,QAAQ,QAAQ;AACnC,eAAW,WAAW,OAAO,UAAU;AACrC,UAAI,QAAQ,SAAS,UAAU,OAAO,QAAQ,SAAS,UAAU;AAC/D,YAAI,OAAO,QAAQ;AACnB,mBAAW,YAAY,WAAW;AAChC,gBAAM,cAAc,OAAO,SAAS,KAAK,KAAK,SAAS,gBAAgB;AACvE,iBAAO,KAAK,WAAW,KAAK,SAAS,KAAK,MAAM,WAAW;AAAA,QAC7D;AACA,gBAAQ,OAAO;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AAEA,SAAO,IAAI,YAAY,EAAE,OAAO,KAAK,UAAU,OAAO,CAAC;AACzD;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@richardmcquiston01/unofficial-xcs-writer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Read, write, and apply variable substitution to xTool Creative Space .xcs files",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Richard McQuiston <richard.mcquiston01@gmail.com>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/RichardMcQuiston01/unofficial-xcs-writer.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/RichardMcQuiston01/unofficial-xcs-writer#readme",
|
|
12
|
+
"bugs": "https://github.com/RichardMcQuiston01/unofficial-xcs-writer/issues",
|
|
13
|
+
"keywords": ["xtool", "xcs", "laser", "template", "variable-substitution"],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"require": "./dist/index.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"main": "./dist/index.cjs",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"files": ["dist"],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsup",
|
|
28
|
+
"dev": "tsup --watch",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:watch": "vitest"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"tsup": "^8.0.0",
|
|
35
|
+
"typescript": "^5.4.0",
|
|
36
|
+
"vitest": "^1.6.0"
|
|
37
|
+
}
|
|
38
|
+
}
|