@ikas/component-cli 1.4.0-beta.160 → 1.4.0-beta.161
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/dist/build-tools.d.ts +19 -0
- package/dist/build-tools.d.ts.map +1 -1
- package/dist/build-tools.js +18 -0
- package/dist/build-tools.js.map +1 -1
- package/dist/commands/create.d.ts +4 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +228 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/get-available-values.d.ts +3 -0
- package/dist/commands/get-available-values.d.ts.map +1 -0
- package/dist/commands/get-available-values.js +49 -0
- package/dist/commands/get-available-values.js.map +1 -0
- package/dist/commands/proxy.d.ts +39 -0
- package/dist/commands/proxy.d.ts.map +1 -0
- package/dist/commands/proxy.js +210 -0
- package/dist/commands/proxy.js.map +1 -0
- package/dist/commands/search-categories.d.ts +3 -0
- package/dist/commands/search-categories.d.ts.map +1 -0
- package/dist/commands/search-categories.js +26 -0
- package/dist/commands/search-categories.js.map +1 -0
- package/dist/commands/set-dynamic-value.d.ts +3 -0
- package/dist/commands/set-dynamic-value.d.ts.map +1 -0
- package/dist/commands/set-dynamic-value.js +54 -0
- package/dist/commands/set-dynamic-value.js.map +1 -0
- package/dist/commands/update-section-props.d.ts +3 -0
- package/dist/commands/update-section-props.d.ts.map +1 -0
- package/dist/commands/update-section-props.js +43 -0
- package/dist/commands/update-section-props.js.map +1 -0
- package/dist/utils/compile.d.ts +13 -1
- package/dist/utils/compile.d.ts.map +1 -1
- package/dist/utils/compile.js +53 -12
- package/dist/utils/compile.js.map +1 -1
- package/dist/utils/esm-transform.d.ts.map +1 -1
- package/dist/utils/esm-transform.js +18 -2
- package/dist/utils/esm-transform.js.map +1 -1
- package/dist/utils/forbid-external-packages.d.ts +11 -1
- package/dist/utils/forbid-external-packages.d.ts.map +1 -1
- package/dist/utils/forbid-external-packages.js +3 -1
- package/dist/utils/forbid-external-packages.js.map +1 -1
- package/dist/utils/theme-source-archive.d.ts +25 -0
- package/dist/utils/theme-source-archive.d.ts.map +1 -0
- package/dist/utils/theme-source-archive.js +70 -0
- package/dist/utils/theme-source-archive.js.map +1 -0
- package/dist/utils/upload-theme-source.d.ts +32 -0
- package/dist/utils/upload-theme-source.d.ts.map +1 -0
- package/dist/utils/upload-theme-source.js +21 -0
- package/dist/utils/upload-theme-source.js.map +1 -0
- package/dist/utils/vendor-storefront.d.ts +13 -0
- package/dist/utils/vendor-storefront.d.ts.map +1 -0
- package/dist/utils/vendor-storefront.js +91 -0
- package/dist/utils/vendor-storefront.js.map +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ThemeSourceArchiveResult {
|
|
2
|
+
/** Absolute path of the zip file that was written. */
|
|
3
|
+
filePath: string;
|
|
4
|
+
/** Number of files written into the archive. */
|
|
5
|
+
fileCount: number;
|
|
6
|
+
/** Compressed size of the archive, in bytes. */
|
|
7
|
+
sizeBytes: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Zip the developer's theme source code — everything under `projectRoot` that
|
|
11
|
+
* isn't a dependency, build artifact, or dotfile — into a zip file on disk at
|
|
12
|
+
* `outputPath`.
|
|
13
|
+
*
|
|
14
|
+
* Uses the same `archiver` library the code-generator relies on, streaming
|
|
15
|
+
* straight to a write stream so large themes don't have to be buffered whole.
|
|
16
|
+
* The caller is responsible for deleting `outputPath` once it has been uploaded.
|
|
17
|
+
*
|
|
18
|
+
* @param projectRoot Absolute path to the theme project root (the directory
|
|
19
|
+
* containing `ikas.config.json`).
|
|
20
|
+
* @param outputPath Absolute path of the zip file to create.
|
|
21
|
+
* @param extraIgnore Additional glob patterns to exclude, merged with the
|
|
22
|
+
* defaults above.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createThemeSourceZipFile(projectRoot: string, outputPath: string, extraIgnore?: string[]): Promise<ThemeSourceArchiveResult>;
|
|
25
|
+
//# sourceMappingURL=theme-source-archive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-source-archive.d.ts","sourceRoot":"","sources":["../../src/utils/theme-source-archive.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,wBAAwB;IACvC,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,MAAM,EAAO,GACzB,OAAO,CAAC,wBAAwB,CAAC,CAqCnC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import archiver from "archiver";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
/**
|
|
4
|
+
* Glob patterns never included in the theme source archive: dependencies, build
|
|
5
|
+
* artifacts, VCS metadata and incidental junk. Dotfiles are excluded separately
|
|
6
|
+
* via `dot: false` (so `.env`, `.git`, etc. never leak into the upload).
|
|
7
|
+
*/
|
|
8
|
+
const DEFAULT_IGNORE = [
|
|
9
|
+
"node_modules/**",
|
|
10
|
+
"dist/**",
|
|
11
|
+
"build/**",
|
|
12
|
+
".turbo/**",
|
|
13
|
+
// Output of `ikas-component publish` (compiled bundle, not source).
|
|
14
|
+
"ikas-components.json",
|
|
15
|
+
"**/*.zip",
|
|
16
|
+
"**/*.log",
|
|
17
|
+
"**/.DS_Store",
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Zip the developer's theme source code — everything under `projectRoot` that
|
|
21
|
+
* isn't a dependency, build artifact, or dotfile — into a zip file on disk at
|
|
22
|
+
* `outputPath`.
|
|
23
|
+
*
|
|
24
|
+
* Uses the same `archiver` library the code-generator relies on, streaming
|
|
25
|
+
* straight to a write stream so large themes don't have to be buffered whole.
|
|
26
|
+
* The caller is responsible for deleting `outputPath` once it has been uploaded.
|
|
27
|
+
*
|
|
28
|
+
* @param projectRoot Absolute path to the theme project root (the directory
|
|
29
|
+
* containing `ikas.config.json`).
|
|
30
|
+
* @param outputPath Absolute path of the zip file to create.
|
|
31
|
+
* @param extraIgnore Additional glob patterns to exclude, merged with the
|
|
32
|
+
* defaults above.
|
|
33
|
+
*/
|
|
34
|
+
export async function createThemeSourceZipFile(projectRoot, outputPath, extraIgnore = []) {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
36
|
+
const output = fs.createWriteStream(outputPath);
|
|
37
|
+
const archive = archiver("zip", { zlib: { level: 9 } });
|
|
38
|
+
let fileCount = 0;
|
|
39
|
+
// `close` fires once all bytes have been flushed to disk — only then is the
|
|
40
|
+
// pointer (total size) final and the file safe to upload.
|
|
41
|
+
output.on("close", () => {
|
|
42
|
+
resolve({
|
|
43
|
+
filePath: outputPath,
|
|
44
|
+
fileCount,
|
|
45
|
+
sizeBytes: archive.pointer(),
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
output.on("error", reject);
|
|
49
|
+
archive.on("entry", () => {
|
|
50
|
+
fileCount += 1;
|
|
51
|
+
});
|
|
52
|
+
// A file vanishing mid-walk (ENOENT) is non-fatal; anything else is a real
|
|
53
|
+
// failure and should reject.
|
|
54
|
+
archive.on("warning", (err) => {
|
|
55
|
+
if (err?.code === "ENOENT")
|
|
56
|
+
return;
|
|
57
|
+
reject(err);
|
|
58
|
+
});
|
|
59
|
+
archive.on("error", reject);
|
|
60
|
+
archive.pipe(output);
|
|
61
|
+
archive.glob("**/*", {
|
|
62
|
+
cwd: projectRoot,
|
|
63
|
+
dot: false,
|
|
64
|
+
nodir: true,
|
|
65
|
+
ignore: [...DEFAULT_IGNORE, ...extraIgnore],
|
|
66
|
+
});
|
|
67
|
+
void archive.finalize();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=theme-source-archive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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E,IAAI,KAAK,QAAQ;gBAAE,OAAO;YACnC,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAE5B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;YACnB,GAAG,EAAE,WAAW;YAChB,GAAG,EAAE,KAAK;YACV,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,CAAC,GAAG,cAAc,EAAE,GAAG,WAAW,CAAC;SAC5C,CAAC,CAAC;QACH,KAAK,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ThemeSourceUploadInput {
|
|
2
|
+
/** Stable project id from ikas.config.json (may be absent on legacy projects). */
|
|
3
|
+
projectId?: string;
|
|
4
|
+
/** Human-readable theme name from ikas.config.json. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Theme version from ikas.config.json. */
|
|
7
|
+
version: string;
|
|
8
|
+
/** Absolute path to the zipped theme source code on disk. */
|
|
9
|
+
zipPath: string;
|
|
10
|
+
/** Compressed size of the zip, in bytes. */
|
|
11
|
+
sizeBytes: number;
|
|
12
|
+
/** Number of files inside the zip. */
|
|
13
|
+
fileCount: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Send the zipped theme source code to the theme-source API.
|
|
17
|
+
*
|
|
18
|
+
* TODO(API): intentionally left unimplemented — this is the seam where the
|
|
19
|
+
* actual upload goes. Read the file at `input.zipPath` (e.g.
|
|
20
|
+
* `fs.createReadStream(input.zipPath)`) and POST it together with `projectId` /
|
|
21
|
+
* `name` / `version`. Throw on a non-2xx response so the caller can surface a
|
|
22
|
+
* warning. The caller deletes `input.zipPath` after this resolves or rejects,
|
|
23
|
+
* so don't delete it here.
|
|
24
|
+
*
|
|
25
|
+
* Reference fields available:
|
|
26
|
+
* - input.zipPath string absolute path to the zip to upload
|
|
27
|
+
* - input.sizeBytes number compressed size
|
|
28
|
+
* - input.fileCount number files in the archive
|
|
29
|
+
* - input.projectId / input.name / input.version
|
|
30
|
+
*/
|
|
31
|
+
export declare function uploadThemeSource(input: ThemeSourceUploadInput): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=upload-theme-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-theme-source.d.ts","sourceRoot":"","sources":["../../src/utils/upload-theme-source.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send the zipped theme source code to the theme-source API.
|
|
3
|
+
*
|
|
4
|
+
* TODO(API): intentionally left unimplemented — this is the seam where the
|
|
5
|
+
* actual upload goes. Read the file at `input.zipPath` (e.g.
|
|
6
|
+
* `fs.createReadStream(input.zipPath)`) and POST it together with `projectId` /
|
|
7
|
+
* `name` / `version`. Throw on a non-2xx response so the caller can surface a
|
|
8
|
+
* warning. The caller deletes `input.zipPath` after this resolves or rejects,
|
|
9
|
+
* so don't delete it here.
|
|
10
|
+
*
|
|
11
|
+
* Reference fields available:
|
|
12
|
+
* - input.zipPath string absolute path to the zip to upload
|
|
13
|
+
* - input.sizeBytes number compressed size
|
|
14
|
+
* - input.fileCount number files in the archive
|
|
15
|
+
* - input.projectId / input.name / input.version
|
|
16
|
+
*/
|
|
17
|
+
export async function uploadThemeSource(input) {
|
|
18
|
+
// Intentionally empty. Implement the API call here.
|
|
19
|
+
void input;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=upload-theme-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-theme-source.js","sourceRoot":"","sources":["../../src/utils/upload-theme-source.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAA6B;IAE7B,oDAAoD;IACpD,KAAK,KAAK,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Plugin } from "esbuild";
|
|
2
|
+
export declare function isVendoredDependencyFile(file: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Bundle the storefront SDK into the component artifact.
|
|
5
|
+
*
|
|
6
|
+
* Deep imports stay forbidden for *component* source — the public contract is still "import only
|
|
7
|
+
* from the package root", and a component reaching into `/src/...` is still a bug worth failing
|
|
8
|
+
* on. But the SDK's own modules deep-import each other constantly (97 lazy `import()` calls into
|
|
9
|
+
* `@ikas/bp-storefront-api/src/__api/...` alone), and those are internal business. So the rule is
|
|
10
|
+
* keyed on who is importing, not on what is imported.
|
|
11
|
+
*/
|
|
12
|
+
export declare function vendorStorefrontPlugin(): Plugin;
|
|
13
|
+
//# sourceMappingURL=vendor-storefront.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor-storefront.d.ts","sourceRoot":"","sources":["../../src/utils/vendor-storefront.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAqCtC,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAK9D;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CA+B/C"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as os from "os";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
/**
|
|
5
|
+
* Compile the storefront SDK *into* the artifact instead of resolving it against the host.
|
|
6
|
+
*
|
|
7
|
+
* The default path (`forbidDeepStorefrontImportsPlugin`) leaves `@ikas/bp-storefront*` external,
|
|
8
|
+
* so a theme has to hand the component every named export it uses at runtime. That makes the set
|
|
9
|
+
* of names a contract between two independently-released things: publish a component that reaches
|
|
10
|
+
* for a name older themes lack and the page renders an error box for every visitor, with nothing
|
|
11
|
+
* to fall back to.
|
|
12
|
+
*
|
|
13
|
+
* Vendoring removes the contract rather than versioning it. The artifact carries the SDK code it
|
|
14
|
+
* was built against, so what a host must still provide shrinks to the handful of packages that
|
|
15
|
+
* genuinely have to be shared (`preact`, `preact/hooks`, `mobx` — see the externals in compile.ts)
|
|
16
|
+
* and cannot grow when we add a feature.
|
|
17
|
+
*
|
|
18
|
+
* The trade is duplication: a page rendering a vendored component ships this code even though the
|
|
19
|
+
* theme already has its own copy. That is the point — the two copies are free to be different
|
|
20
|
+
* versions.
|
|
21
|
+
*/
|
|
22
|
+
/** `@ikas/bp-storefront` and its siblings, with an optional subpath. */
|
|
23
|
+
const VENDORED_PKG = /^(@ikas\/bp-storefront(?:-(?:models|config|api|api-client))?)(\/.*)?$/;
|
|
24
|
+
/**
|
|
25
|
+
* True for files that belong to a vendored dependency rather than to component source.
|
|
26
|
+
*
|
|
27
|
+
* Two shapes, because the SDK resolves differently depending on where the build runs: an npm
|
|
28
|
+
* install puts it under `node_modules/@ikas/bp-storefront*`, while inside this monorepo npm
|
|
29
|
+
* workspaces symlink it and esbuild reports the real path under `packages/storefront*`.
|
|
30
|
+
*/
|
|
31
|
+
const VENDORED_FILE = /[\\/](?:node_modules[\\/]@ikas[\\/]bp-storefront[^\\/]*|packages[\\/]storefront(?:-(?:api|api-client|config|models))?)[\\/]/;
|
|
32
|
+
export function isVendoredDependencyFile(file) {
|
|
33
|
+
if (!file)
|
|
34
|
+
return false;
|
|
35
|
+
// Anything already inside node_modules is a transitive dependency of a package we chose to
|
|
36
|
+
// vendor, not something a component author wrote — the allowlist has no say over it.
|
|
37
|
+
return file.includes(`${path.sep}node_modules${path.sep}`) || VENDORED_FILE.test(file);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Stand-in for `isomorphic-fetch`, which the SDK imports in three places.
|
|
41
|
+
*
|
|
42
|
+
* That package pulls `node-fetch` in, which references `global` and dies in a browser with
|
|
43
|
+
* "global is not defined" — a failure the monorepo never sees while the SDK is merely *external*,
|
|
44
|
+
* because nothing bundles it there. Vendoring is exactly what makes it reachable, so it has to be
|
|
45
|
+
* aliased away here rather than left to be discovered at runtime.
|
|
46
|
+
*
|
|
47
|
+
* Both build targets already have a native `fetch` (browsers, and Node 18+ for the SSR build), so
|
|
48
|
+
* the shim is a forwarder. It calls through `globalThis` on every invocation instead of capturing
|
|
49
|
+
* the function, which keeps `this` correct (a bare reference throws "Illegal invocation") and lets
|
|
50
|
+
* a host install a polyfill after this module is evaluated.
|
|
51
|
+
*/
|
|
52
|
+
const FETCH_SHIM = path.join(os.tmpdir(), "ikas-vendored-fetch-shim.mjs");
|
|
53
|
+
fs.writeFileSync(FETCH_SHIM, "const f = (...args) => globalThis.fetch(...args);\nexport default f;\nexport { f as fetch };\n");
|
|
54
|
+
/**
|
|
55
|
+
* Bundle the storefront SDK into the component artifact.
|
|
56
|
+
*
|
|
57
|
+
* Deep imports stay forbidden for *component* source — the public contract is still "import only
|
|
58
|
+
* from the package root", and a component reaching into `/src/...` is still a bug worth failing
|
|
59
|
+
* on. But the SDK's own modules deep-import each other constantly (97 lazy `import()` calls into
|
|
60
|
+
* `@ikas/bp-storefront-api/src/__api/...` alone), and those are internal business. So the rule is
|
|
61
|
+
* keyed on who is importing, not on what is imported.
|
|
62
|
+
*/
|
|
63
|
+
export function vendorStorefrontPlugin() {
|
|
64
|
+
return {
|
|
65
|
+
name: "ikas-vendor-storefront",
|
|
66
|
+
setup(build) {
|
|
67
|
+
build.onResolve({ filter: /^isomorphic-fetch$/ }, () => ({ path: FETCH_SHIM }));
|
|
68
|
+
build.onResolve({ filter: VENDORED_PKG }, (args) => {
|
|
69
|
+
const [, root, subpath] = args.path.match(VENDORED_PKG);
|
|
70
|
+
if (subpath && subpath !== "/" && !isVendoredDependencyFile(args.importer)) {
|
|
71
|
+
return {
|
|
72
|
+
errors: [
|
|
73
|
+
{
|
|
74
|
+
text: `Deep import "${args.path}" is not allowed. Import only from the package root ` +
|
|
75
|
+
`"${root}" — e.g. import { saveCouponCode, getCart } from "${root}". ` +
|
|
76
|
+
`Subpaths like "/dist/..." or "/src/..." are private and may be renamed without ` +
|
|
77
|
+
`notice. If a helper seems missing from the root, it almost always has a public ` +
|
|
78
|
+
`name there (coupon code, for instance, is getCouponCodeForm / ` +
|
|
79
|
+
`setCouponCodeFormCouponCode / submitCouponCodeForm).`,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Returning nothing hands the specifier back to esbuild's normal resolution, which is
|
|
85
|
+
// what pulls the source into the bundle. The default path returns `external: true` here.
|
|
86
|
+
return undefined;
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=vendor-storefront.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor-storefront.js","sourceRoot":"","sources":["../../src/utils/vendor-storefront.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;;;;;;;;;;;;;GAiBG;AAEH,wEAAwE;AACxE,M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K;oCACtE,iFAAiF;oCACjF,iFAAiF;oCACjF,gEAAgE;oCAChE,sDAAsD;6BACzD;yBACF;qBACF,CAAC;gBACJ,CAAC;gBAED,sFAAsF;gBACtF,yFAAyF;gBACzF,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/component-cli",
|
|
3
|
-
"version": "1.4.0-beta.
|
|
3
|
+
"version": "1.4.0-beta.161",
|
|
4
4
|
"description": "CLI for developing ikas code components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
12
|
},
|
|
13
|
-
"./build-tools":
|
|
13
|
+
"./build-tools": {
|
|
14
|
+
"types": "./dist/build-tools.d.ts",
|
|
15
|
+
"default": "./dist/build-tools.js"
|
|
16
|
+
},
|
|
14
17
|
"./package.json": "./package.json"
|
|
15
18
|
},
|
|
16
19
|
"bin": {
|