@cesdk/node 1.77.0-nightly.20260601 → 1.77.0-nightly.20260610
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/assets/core/{cesdk-v1.77.0-nightly.20260601-N34K3GO3.wasm → cesdk-v1.77.0-nightly.20260610-QHEYKLJ4.wasm} +0 -0
- package/example.js +34 -0
- package/example.mjs +59 -0
- package/index.d.cts +29 -0
- package/index.d.mts +10590 -0
- package/index.d.ts +58 -23
- package/index.js +1 -1
- package/index.mjs +1 -0
- package/package.json +17 -3
- /package/assets/core/{cesdk-v1.77.0-nightly.20260601-MLEZSZ4D.data → cesdk-v1.77.0-nightly.20260610-MLEZSZ4D.data} +0 -0
|
Binary file
|
package/example.js
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
3
3
|
const fs = require('fs/promises');
|
|
4
4
|
const CreativeEngine = require('./index.js');
|
|
5
5
|
|
|
6
|
+
// Assert the CJS named-export surface so a regression in the build pipeline
|
|
7
|
+
// (index.cjs.ts shim, exports map, …) fails this script. Mirrors example.mjs.
|
|
8
|
+
const {
|
|
9
|
+
LogLevel,
|
|
10
|
+
isRGBAColor,
|
|
11
|
+
isCMYKColor,
|
|
12
|
+
isSpotColor,
|
|
13
|
+
CompressionFormat,
|
|
14
|
+
CompressionLevel,
|
|
15
|
+
MimeType,
|
|
16
|
+
DESIGN_BLOCK_TYPES
|
|
17
|
+
} = CreativeEngine;
|
|
18
|
+
const expectedNamedExports = {
|
|
19
|
+
LogLevel,
|
|
20
|
+
isRGBAColor,
|
|
21
|
+
isCMYKColor,
|
|
22
|
+
isSpotColor,
|
|
23
|
+
CompressionFormat,
|
|
24
|
+
CompressionLevel,
|
|
25
|
+
MimeType,
|
|
26
|
+
DESIGN_BLOCK_TYPES
|
|
27
|
+
};
|
|
28
|
+
for (const [name, value] of Object.entries(expectedNamedExports)) {
|
|
29
|
+
if (value === undefined) {
|
|
30
|
+
console.error(`CJS named export "${name}" is undefined`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (typeof CreativeEngine?.init !== 'function') {
|
|
35
|
+
console.error('CJS default export is not the CreativeEngine class');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
6
39
|
const license = process.env.CESDK_LICENSE;
|
|
7
40
|
|
|
8
41
|
CreativeEngine.init({ license }).then(async (engine) => {
|
|
@@ -23,6 +56,7 @@ CreativeEngine.init({ license }).then(async (engine) => {
|
|
|
23
56
|
})
|
|
24
57
|
.catch((err) => {
|
|
25
58
|
console.error(err);
|
|
59
|
+
process.exitCode = 1;
|
|
26
60
|
})
|
|
27
61
|
.finally(() => {
|
|
28
62
|
engine.dispose();
|
package/example.mjs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { dirname } from 'path';
|
|
5
|
+
import fs from 'fs/promises';
|
|
6
|
+
import CreativeEngine, {
|
|
7
|
+
LogLevel,
|
|
8
|
+
isRGBAColor,
|
|
9
|
+
isCMYKColor,
|
|
10
|
+
isSpotColor,
|
|
11
|
+
CompressionFormat,
|
|
12
|
+
CompressionLevel,
|
|
13
|
+
MimeType,
|
|
14
|
+
DESIGN_BLOCK_TYPES
|
|
15
|
+
} from './index.mjs';
|
|
16
|
+
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
|
|
19
|
+
// Assert the ESM named-export surface so a regression in the build pipeline
|
|
20
|
+
// (esbuild banner, index.cjs.ts shim, exports map, …) fails this script.
|
|
21
|
+
const expectedNamedExports = {
|
|
22
|
+
LogLevel,
|
|
23
|
+
isRGBAColor,
|
|
24
|
+
isCMYKColor,
|
|
25
|
+
isSpotColor,
|
|
26
|
+
CompressionFormat,
|
|
27
|
+
CompressionLevel,
|
|
28
|
+
MimeType,
|
|
29
|
+
DESIGN_BLOCK_TYPES
|
|
30
|
+
};
|
|
31
|
+
for (const [name, value] of Object.entries(expectedNamedExports)) {
|
|
32
|
+
if (value === undefined) {
|
|
33
|
+
console.error(`ESM named export "${name}" is undefined`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (typeof CreativeEngine?.init !== 'function') {
|
|
38
|
+
console.error('ESM default export is not the CreativeEngine class');
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const license = process.env.CESDK_LICENSE;
|
|
43
|
+
|
|
44
|
+
const engine = await CreativeEngine.init({ license });
|
|
45
|
+
console.log('Loading scene');
|
|
46
|
+
try {
|
|
47
|
+
await engine.scene.loadFromURL(`file://${__dirname}/demo.scene`);
|
|
48
|
+
console.log('Scene loaded, exporting page');
|
|
49
|
+
const [page] = engine.block.findByType('page');
|
|
50
|
+
const blob = await engine.block.export(page, { mimeType: 'image/png' });
|
|
51
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
52
|
+
console.log('Writing output: example-output-esm.png');
|
|
53
|
+
await fs.writeFile('./example-output-esm.png', Buffer.from(arrayBuffer));
|
|
54
|
+
} catch (err) {
|
|
55
|
+
console.error(err);
|
|
56
|
+
process.exitCode = 1;
|
|
57
|
+
} finally {
|
|
58
|
+
engine.dispose();
|
|
59
|
+
}
|
package/index.d.cts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// CommonJS type surface for `@cesdk/node`.
|
|
2
|
+
//
|
|
3
|
+
// The published package ships dual builds: the `import` condition resolves to
|
|
4
|
+
// ESM (`index.mjs`, typed by `index.d.mts`) and the `require` condition
|
|
5
|
+
// resolves to CJS (`index.js`, typed by this file). The runtime CJS module (see
|
|
6
|
+
// `src/index.cjs.ts`) sets `module.exports` to the `CreativeEngine` class
|
|
7
|
+
// itself, then attaches every named export — plus a `default` reference — as
|
|
8
|
+
// own properties.
|
|
9
|
+
//
|
|
10
|
+
// - `export =` mirrors that runtime value shape so a CommonJS consumer under
|
|
11
|
+
// `node16`/`nodenext` type-checks the default class and its attached members:
|
|
12
|
+
// const CreativeEngine = require('@cesdk/node');
|
|
13
|
+
// await CreativeEngine.init({ license }); // the class (default export)
|
|
14
|
+
// CreativeEngine.LogLevel; // an attached named export
|
|
15
|
+
// - `export * from './index.js'` additionally re-exports the named TYPE and
|
|
16
|
+
// value exports, so `import type { Configuration } from '@cesdk/node'` and
|
|
17
|
+
// `import { LogLevel } from '@cesdk/node'` keep resolving under `require`
|
|
18
|
+
// (an `export =` on its own would hide every named export).
|
|
19
|
+
//
|
|
20
|
+
// Both forms derive from the ESM rollup (`index.d.ts`, resolved via the sibling
|
|
21
|
+
// `./index.js`), so this file never drifts from the public API surface. It is
|
|
22
|
+
// copied next to the rollup at build time by `scripts/build.types.sh`.
|
|
23
|
+
type CesdkNodeModule = (typeof import('./index.js'))['default'] &
|
|
24
|
+
typeof import('./index.js');
|
|
25
|
+
|
|
26
|
+
declare const CreativeEngine: CesdkNodeModule;
|
|
27
|
+
|
|
28
|
+
export = CreativeEngine;
|
|
29
|
+
export * from './index.js';
|