@pezkuwi/dev 0.85.2 → 0.85.4
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/.skip-deno +0 -0
- package/README.md +547 -0
- package/build-deno/README.md +547 -0
- package/build-deno/detectOther.ts +2 -0
- package/build-deno/index.ts +4 -0
- package/build-deno/mod.ts +10 -0
- package/build-deno/packageInfo.ts +3 -0
- package/build-deno/root.ts +4 -0
- package/build-deno/rootJs/Clazz.ts +43 -0
- package/build-deno/rootJs/Jsx.tsx +42 -0
- package/build-deno/rootJs/JsxChild.tsx +18 -0
- package/build-deno/rootJs/augmented.ts +12 -0
- package/build-deno/rootJs/dynamic.d.mts +4 -0
- package/build-deno/rootJs/dynamic.mjs +13 -0
- package/build-deno/rootJs/index.ts +53 -0
- package/build-deno/rootJs/test.json.d.ts +9 -0
- package/build-deno/rootJs/testJson.json +5 -0
- package/build-deno/rootRust/lib.rs +1 -0
- package/build-deno/rootRust/mod.rs +1 -0
- package/build-deno/rootStatic/zagros.svg +1 -0
- package/build-deno/rootTests.ts +60 -0
- package/build-deno/types.ts +6 -0
- package/build-tsc/detectOther.d.ts +2 -0
- package/build-tsc/index.d.ts +1 -0
- package/build-tsc/packageInfo.d.ts +6 -0
- package/build-tsc/root.d.ts +2 -0
- package/build-tsc/rootJs/Clazz.d.ts +18 -0
- package/build-tsc/rootJs/Jsx.d.ts +5 -0
- package/build-tsc/rootJs/JsxChild.d.ts +9 -0
- package/build-tsc/rootJs/augmented.d.ts +8 -0
- package/build-tsc/rootJs/index.d.ts +19 -0
- package/build-tsc/rootTests.d.ts +2 -0
- package/build-tsc/types.d.ts +2 -0
- package/build-tsc-cjs/detectOther.js +5 -0
- package/build-tsc-cjs/index.js +5 -0
- package/build-tsc-cjs/packageInfo.js +7 -0
- package/build-tsc-cjs/root.js +8 -0
- package/build-tsc-cjs/rootJs/Clazz.js +38 -0
- package/build-tsc-cjs/rootJs/Jsx.js +16 -0
- package/build-tsc-cjs/rootJs/JsxChild.js +11 -0
- package/build-tsc-cjs/rootJs/augmented.js +4 -0
- package/build-tsc-cjs/rootJs/index.js +53 -0
- package/build-tsc-cjs/rootTests.js +46 -0
- package/build-tsc-cjs/types.js +4 -0
- package/build-tsc-esm/detectOther.js +3 -0
- package/build-tsc-esm/index.js +4 -0
- package/build-tsc-esm/packageInfo.js +4 -0
- package/build-tsc-esm/root.js +4 -0
- package/build-tsc-esm/rootJs/Clazz.js +34 -0
- package/build-tsc-esm/rootJs/Jsx.js +13 -0
- package/build-tsc-esm/rootJs/JsxChild.js +8 -0
- package/build-tsc-esm/rootJs/augmented.js +3 -0
- package/build-tsc-esm/rootJs/index.js +41 -0
- package/build-tsc-esm/rootTests.js +43 -0
- package/build-tsc-esm/types.js +3 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/sample.js +1 -1
- package/config/eslint.js +14 -2
- package/config/eslint.rules.js +2 -2
- package/config/prettier.cjs +1 -1
- package/config/rollup.js +1 -1
- package/config/typedoc.cjs +1 -1
- package/package.json +41 -41
- package/packageInfo.js +1 -1
- package/rootJs/dynamic.mjs +1 -1
- package/scripts/pezkuwi-ci-ghact-build.mjs +5 -1
- package/scripts/pezkuwi-ci-ghact-docs.mjs +1 -1
- package/scripts/pezkuwi-ci-ghpages-force.mjs +1 -1
- package/scripts/pezkuwi-dev-build-docs.mjs +1 -1
- package/scripts/pezkuwi-dev-build-ts.mjs +1 -1
- package/scripts/pezkuwi-dev-circular.mjs +1 -1
- package/scripts/pezkuwi-dev-clean-build.mjs +1 -1
- package/scripts/pezkuwi-dev-contrib.mjs +1 -1
- package/scripts/pezkuwi-dev-copy-dir.mjs +1 -1
- package/scripts/pezkuwi-dev-copy-to.mjs +1 -1
- package/scripts/pezkuwi-dev-deno-map.mjs +1 -1
- package/scripts/pezkuwi-dev-run-lint.mjs +1 -1
- package/scripts/pezkuwi-dev-run-node-ts.mjs +1 -1
- package/scripts/pezkuwi-dev-run-test.mjs +1 -1
- package/scripts/pezkuwi-dev-version.mjs +1 -1
- package/scripts/pezkuwi-dev-yarn-only.mjs +1 -1
- package/scripts/pezkuwi-exec-eslint.mjs +1 -1
- package/scripts/pezkuwi-exec-ghpages.mjs +1 -1
- package/scripts/pezkuwi-exec-ghrelease.mjs +1 -1
- package/scripts/pezkuwi-exec-node-test.mjs +1 -1
- package/scripts/pezkuwi-exec-rollup.mjs +1 -1
- package/scripts/pezkuwi-exec-tsc.mjs +1 -1
- package/scripts/pezkuwi-exec-webpack.mjs +1 -1
- package/scripts/util.mjs +1 -1
- package/tsconfig.build.json +18 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.config.json +14 -0
- package/tsconfig.scripts.json +14 -0
- package/tsconfig.spec.json +18 -0
- package/tsconfig.spec.tsbuildinfo +1 -0
- package/package.json.new +0 -315
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns the sum of 2 numbers
|
|
6
|
+
*
|
|
7
|
+
* @param {number} a
|
|
8
|
+
* @param {number} b
|
|
9
|
+
* @returns {number}
|
|
10
|
+
*/
|
|
11
|
+
export function sum (a, b) {
|
|
12
|
+
return a + b;
|
|
13
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/** This should appear as-is in the output with: 1. extension added, 2. augmented.d.ts correct */
|
|
5
|
+
import './augmented.js';
|
|
6
|
+
|
|
7
|
+
/** This import should appear as-in in the ouput (cjs without asserts) */
|
|
8
|
+
import testJson from '@pezkuwi/dev/rootJs/testJson.json' with { type: 'json' };
|
|
9
|
+
|
|
10
|
+
/** Double double work, i.e. re-exports */
|
|
11
|
+
export { Clazz } from './Clazz.js';
|
|
12
|
+
|
|
13
|
+
/** Function to ensure that BigInt does not have the Babel Math.pow() transform */
|
|
14
|
+
export function bigIntExp (): bigint {
|
|
15
|
+
// 123_456n * 137_858_491_849n
|
|
16
|
+
return 123_456_789n * (13n ** 10n);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Function to ensure that dynamic imports work */
|
|
20
|
+
export async function dynamic (a: number, b: number): Promise<number> {
|
|
21
|
+
// NOTE we go via this path so it points to the same location in both ESM
|
|
22
|
+
// and CJS output (a './dynamic' import would be different otherwise)
|
|
23
|
+
const { sum } = await import('@pezkuwi/dev/rootJs/dynamic.mjs');
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
26
|
+
return sum(a, b);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Function to ensure we have json correctly imported */
|
|
30
|
+
export function json (): string {
|
|
31
|
+
return testJson.test.json;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Check support for the ?? operator */
|
|
35
|
+
export function jsOpExp (a?: number): number {
|
|
36
|
+
const defaults = {
|
|
37
|
+
a: 42,
|
|
38
|
+
b: 43,
|
|
39
|
+
c: 44
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return a ?? defaults.a;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** This is an actual check to ensure PURE is all-happy */
|
|
46
|
+
export const pureOpExp = /*#__PURE__*/ jsOpExp();
|
|
47
|
+
|
|
48
|
+
const fooA = 1;
|
|
49
|
+
const fooB = 2;
|
|
50
|
+
const fooC = 3;
|
|
51
|
+
const fooD = 4;
|
|
52
|
+
|
|
53
|
+
export { fooA, fooB, fooC, fooD };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/** This file should not be in the compiled output */
|
|
5
|
+
|
|
6
|
+
declare module './testJson.json' {
|
|
7
|
+
declare let contents: { test: { json: 'works' } };
|
|
8
|
+
export default contents;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// this should not appear in the final output
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// this should not appear in the final output
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 441 441"><defs><style>.cls-1{stroke:#000;stroke-miterlimit:10;}.cls-2{fill:#fff;}</style></defs><title>kusama-ksm-logo</title><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><rect class="cls-1" x="0.5" y="0.5" width="440" height="440"/><path class="cls-2" d="M373.6,127.4c-5.2-4.1-11.4-9.7-22.7-11.1-10.6-1.4-21.4,5.7-28.7,10.4s-21.1,18.5-26.8,22.7-20.3,8.1-43.8,22.2-115.7,73.3-115.7,73.3l24,.3-107,55.1H63.6L48.2,312s13.6,3.6,25-3.6v3.3s127.4-50.2,152-37.2l-15,4.4c1.3,0,25.5,1.6,25.5,1.6a34.34,34.34,0,0,0,15.4,24.8c14.6,9.6,14.9,14.9,14.9,14.9s-7.6,3.1-7.6,7c0,0,11.2-3.4,21.6-3.1a82.64,82.64,0,0,1,19.5,3.1s-.8-4.2-10.9-7-20.1-13.8-25-19.8a28,28,0,0,1-4.1-27.4c3.5-9.1,15.7-14.1,40.9-27.1,29.7-15.4,36.5-26.8,40.7-35.7s10.4-26.6,13.9-34.9c4.4-10.7,9.8-16.4,14.3-19.8s24.5-10.9,24.5-10.9S378.5,131.3,373.6,127.4Z"/></g></g></svg>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
|
|
5
|
+
|
|
6
|
+
/* global describe, expect, it */
|
|
7
|
+
|
|
8
|
+
import type * as testRoot from './root.js';
|
|
9
|
+
|
|
10
|
+
export function runTests ({ Clazz, TEST_PURE, bigIntExp, dynamic, jsOpExp, json }: typeof testRoot): void {
|
|
11
|
+
describe('Clazz', (): void => {
|
|
12
|
+
it('has staticProperty', (): void => {
|
|
13
|
+
expect(Clazz.staticProperty).toBe('foobar');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('creates an instance with get/set', (): void => {
|
|
17
|
+
const c = new Clazz(456);
|
|
18
|
+
|
|
19
|
+
expect(c.something).toBe(123_456_789 & 456);
|
|
20
|
+
|
|
21
|
+
c.setSomething(123);
|
|
22
|
+
|
|
23
|
+
expect(c.something).toBe(123 & 456);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('TEST_PURE', (): void => {
|
|
28
|
+
it('should have the correct value', (): void => {
|
|
29
|
+
expect(TEST_PURE).toBe('testRoot');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('dynamic()', (): void => {
|
|
34
|
+
it('should allow dynamic import usage', async (): Promise<void> => {
|
|
35
|
+
expect(await dynamic(5, 37)).toBe(42);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('bigIntExp()', (): void => {
|
|
40
|
+
it('should return the correct value', (): void => {
|
|
41
|
+
expect(bigIntExp()).toBe(123_456_789n * 137_858_491_849n);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe('jsOpExp', (): void => {
|
|
46
|
+
it('handles 0 ?? 42 correctly', (): void => {
|
|
47
|
+
expect(jsOpExp(0)).toBe(0);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('handles undefined ?? 42 correctly', (): void => {
|
|
51
|
+
expect(jsOpExp()).toBe(42);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('json()', (): void => {
|
|
56
|
+
it('should return the correct value', (): void => {
|
|
57
|
+
expect(json()).toBe('works');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class Clazz {
|
|
2
|
+
#private;
|
|
3
|
+
readonly and: number;
|
|
4
|
+
static staticProperty: string;
|
|
5
|
+
static staticFunction: () => string | null;
|
|
6
|
+
/**
|
|
7
|
+
* @param and the number we should and with
|
|
8
|
+
*/
|
|
9
|
+
constructor(and: number);
|
|
10
|
+
get something(): number;
|
|
11
|
+
doAsync(): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* @description Sets something to something
|
|
14
|
+
* @param something The addition
|
|
15
|
+
*/
|
|
16
|
+
setSomething: (something?: number) => number;
|
|
17
|
+
toString(): string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface Props {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
declare function Child({ children, className, label }: Props): React.ReactElement<Props>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<typeof Child>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** This should appear as-is in the output with: 1. extension added, 2. augmented.d.ts correct */
|
|
2
|
+
import './augmented.js';
|
|
3
|
+
/** Double double work, i.e. re-exports */
|
|
4
|
+
export { Clazz } from './Clazz.js';
|
|
5
|
+
/** Function to ensure that BigInt does not have the Babel Math.pow() transform */
|
|
6
|
+
export declare function bigIntExp(): bigint;
|
|
7
|
+
/** Function to ensure that dynamic imports work */
|
|
8
|
+
export declare function dynamic(a: number, b: number): Promise<number>;
|
|
9
|
+
/** Function to ensure we have json correctly imported */
|
|
10
|
+
export declare function json(): string;
|
|
11
|
+
/** Check support for the ?? operator */
|
|
12
|
+
export declare function jsOpExp(a?: number): number;
|
|
13
|
+
/** This is an actual check to ensure PURE is all-happy */
|
|
14
|
+
export declare const pureOpExp: number;
|
|
15
|
+
declare const fooA = 1;
|
|
16
|
+
declare const fooB = 2;
|
|
17
|
+
declare const fooC = 3;
|
|
18
|
+
declare const fooD = 4;
|
|
19
|
+
export { fooA, fooB, fooC, fooD };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
throw new Error('@pezkuwi/dev is not meant to be imported via root. Rather if provides a set of shared dependencies, a collection of scripts, base configs and some loaders accessed via the scripts. It is only meant to be used as a shared resource by all @pezkuwi/* projects');
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.packageInfo = void 0;
|
|
6
|
+
// Do not edit, auto-generated by @pezkuwi/dev
|
|
7
|
+
exports.packageInfo = { name: '@pezkuwi/dev', path: 'auto', type: 'auto', version: '0.85.4' };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.TEST_PURE = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
tslib_1.__exportStar(require("./rootJs/index.js"), exports);
|
|
8
|
+
exports.TEST_PURE = 'testRoot';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Clazz = void 0;
|
|
6
|
+
class Clazz {
|
|
7
|
+
#something = 123_456_789;
|
|
8
|
+
and;
|
|
9
|
+
static staticProperty = 'foobar';
|
|
10
|
+
static staticFunction = () => Clazz.staticProperty;
|
|
11
|
+
/**
|
|
12
|
+
* @param and the number we should and with
|
|
13
|
+
*/
|
|
14
|
+
constructor(and) {
|
|
15
|
+
this.and = and;
|
|
16
|
+
this.#something = this.#something & and;
|
|
17
|
+
}
|
|
18
|
+
get something() {
|
|
19
|
+
return this.#something;
|
|
20
|
+
}
|
|
21
|
+
async doAsync() {
|
|
22
|
+
const res = await new Promise((resolve) => resolve(true));
|
|
23
|
+
console.log(res);
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @description Sets something to something
|
|
28
|
+
* @param something The addition
|
|
29
|
+
*/
|
|
30
|
+
setSomething = (something) => {
|
|
31
|
+
this.#something = (something ?? 123_456) & this.and;
|
|
32
|
+
return this.#something;
|
|
33
|
+
};
|
|
34
|
+
toString() {
|
|
35
|
+
return `something=${this.#something}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Clazz = Clazz;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const styled_components_1 = require("styled-components");
|
|
7
|
+
const JsxChild_js_1 = tslib_1.__importDefault(require("./JsxChild.js"));
|
|
8
|
+
function Hidden({ children, className }) {
|
|
9
|
+
const [isMessageVisible, setMessageVisibility] = (0, react_1.useState)(false);
|
|
10
|
+
const onShow = (0, react_1.useCallback)((e) => setMessageVisibility(e.target.checked), []);
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)(StyledDiv, { className: className, children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: 'toggle', children: "Show Message" }), (0, jsx_runtime_1.jsx)("input", { checked: isMessageVisible, id: 'toggle', onChange: onShow, type: 'checkbox' }), isMessageVisible && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [children, (0, jsx_runtime_1.jsx)(JsxChild_js_1.default, { label: 'hello' })] }))] }));
|
|
12
|
+
}
|
|
13
|
+
const StyledDiv = styled_components_1.styled.div `
|
|
14
|
+
background: red;
|
|
15
|
+
`;
|
|
16
|
+
exports.default = react_1.default.memo(Hidden);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
8
|
+
function Child({ children, className, label }) {
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: className, children: [label || '', children] }));
|
|
10
|
+
}
|
|
11
|
+
exports.default = react_1.default.memo(Child);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.fooD = exports.fooC = exports.fooB = exports.fooA = exports.pureOpExp = exports.Clazz = void 0;
|
|
6
|
+
exports.bigIntExp = bigIntExp;
|
|
7
|
+
exports.dynamic = dynamic;
|
|
8
|
+
exports.json = json;
|
|
9
|
+
exports.jsOpExp = jsOpExp;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
/** This should appear as-is in the output with: 1. extension added, 2. augmented.d.ts correct */
|
|
12
|
+
require("./augmented.js");
|
|
13
|
+
/** This import should appear as-in in the ouput (cjs without asserts) */
|
|
14
|
+
const testJson_json_1 = tslib_1.__importDefault(require("@pezkuwi/dev/rootJs/testJson.json"));
|
|
15
|
+
/** Double double work, i.e. re-exports */
|
|
16
|
+
var Clazz_js_1 = require("./Clazz.js");
|
|
17
|
+
Object.defineProperty(exports, "Clazz", { enumerable: true, get: function () { return Clazz_js_1.Clazz; } });
|
|
18
|
+
/** Function to ensure that BigInt does not have the Babel Math.pow() transform */
|
|
19
|
+
function bigIntExp() {
|
|
20
|
+
// 123_456n * 137_858_491_849n
|
|
21
|
+
return 123456789n * (13n ** 10n);
|
|
22
|
+
}
|
|
23
|
+
/** Function to ensure that dynamic imports work */
|
|
24
|
+
async function dynamic(a, b) {
|
|
25
|
+
// NOTE we go via this path so it points to the same location in both ESM
|
|
26
|
+
// and CJS output (a './dynamic' import would be different otherwise)
|
|
27
|
+
const { sum } = await Promise.resolve().then(() => tslib_1.__importStar(require('@pezkuwi/dev/rootJs/dynamic.mjs')));
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
29
|
+
return sum(a, b);
|
|
30
|
+
}
|
|
31
|
+
/** Function to ensure we have json correctly imported */
|
|
32
|
+
function json() {
|
|
33
|
+
return testJson_json_1.default.test.json;
|
|
34
|
+
}
|
|
35
|
+
/** Check support for the ?? operator */
|
|
36
|
+
function jsOpExp(a) {
|
|
37
|
+
const defaults = {
|
|
38
|
+
a: 42,
|
|
39
|
+
b: 43,
|
|
40
|
+
c: 44
|
|
41
|
+
};
|
|
42
|
+
return a ?? defaults.a;
|
|
43
|
+
}
|
|
44
|
+
/** This is an actual check to ensure PURE is all-happy */
|
|
45
|
+
exports.pureOpExp = jsOpExp();
|
|
46
|
+
const fooA = 1;
|
|
47
|
+
exports.fooA = fooA;
|
|
48
|
+
const fooB = 2;
|
|
49
|
+
exports.fooB = fooB;
|
|
50
|
+
const fooC = 3;
|
|
51
|
+
exports.fooC = fooC;
|
|
52
|
+
const fooD = 4;
|
|
53
|
+
exports.fooD = fooD;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.runTests = runTests;
|
|
6
|
+
function runTests({ Clazz, TEST_PURE, bigIntExp, dynamic, jsOpExp, json }) {
|
|
7
|
+
describe('Clazz', () => {
|
|
8
|
+
it('has staticProperty', () => {
|
|
9
|
+
expect(Clazz.staticProperty).toBe('foobar');
|
|
10
|
+
});
|
|
11
|
+
it('creates an instance with get/set', () => {
|
|
12
|
+
const c = new Clazz(456);
|
|
13
|
+
expect(c.something).toBe(123_456_789 & 456);
|
|
14
|
+
c.setSomething(123);
|
|
15
|
+
expect(c.something).toBe(123 & 456);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
describe('TEST_PURE', () => {
|
|
19
|
+
it('should have the correct value', () => {
|
|
20
|
+
expect(TEST_PURE).toBe('testRoot');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe('dynamic()', () => {
|
|
24
|
+
it('should allow dynamic import usage', async () => {
|
|
25
|
+
expect(await dynamic(5, 37)).toBe(42);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('bigIntExp()', () => {
|
|
29
|
+
it('should return the correct value', () => {
|
|
30
|
+
expect(bigIntExp()).toBe(123456789n * 137858491849n);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe('jsOpExp', () => {
|
|
34
|
+
it('handles 0 ?? 42 correctly', () => {
|
|
35
|
+
expect(jsOpExp(0)).toBe(0);
|
|
36
|
+
});
|
|
37
|
+
it('handles undefined ?? 42 correctly', () => {
|
|
38
|
+
expect(jsOpExp()).toBe(42);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe('json()', () => {
|
|
42
|
+
it('should return the correct value', () => {
|
|
43
|
+
expect(json()).toBe('works');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
throw new Error('@pezkuwi/dev is not meant to be imported via root. Rather if provides a set of shared dependencies, a collection of scripts, base configs and some loaders accessed via the scripts. It is only meant to be used as a shared resource by all @pezkuwi/* projects');
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export class Clazz {
|
|
4
|
+
#something = 123_456_789;
|
|
5
|
+
and;
|
|
6
|
+
static staticProperty = 'foobar';
|
|
7
|
+
static staticFunction = () => Clazz.staticProperty;
|
|
8
|
+
/**
|
|
9
|
+
* @param and the number we should and with
|
|
10
|
+
*/
|
|
11
|
+
constructor(and) {
|
|
12
|
+
this.and = and;
|
|
13
|
+
this.#something = this.#something & and;
|
|
14
|
+
}
|
|
15
|
+
get something() {
|
|
16
|
+
return this.#something;
|
|
17
|
+
}
|
|
18
|
+
async doAsync() {
|
|
19
|
+
const res = await new Promise((resolve) => resolve(true));
|
|
20
|
+
console.log(res);
|
|
21
|
+
return res;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @description Sets something to something
|
|
25
|
+
* @param something The addition
|
|
26
|
+
*/
|
|
27
|
+
setSomething = (something) => {
|
|
28
|
+
this.#something = (something ?? 123_456) & this.and;
|
|
29
|
+
return this.#something;
|
|
30
|
+
};
|
|
31
|
+
toString() {
|
|
32
|
+
return `something=${this.#something}`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
|
+
import { styled } from 'styled-components';
|
|
4
|
+
import Child from './JsxChild.js';
|
|
5
|
+
function Hidden({ children, className }) {
|
|
6
|
+
const [isMessageVisible, setMessageVisibility] = useState(false);
|
|
7
|
+
const onShow = useCallback((e) => setMessageVisibility(e.target.checked), []);
|
|
8
|
+
return (_jsxs(StyledDiv, { className: className, children: [_jsx("label", { htmlFor: 'toggle', children: "Show Message" }), _jsx("input", { checked: isMessageVisible, id: 'toggle', onChange: onShow, type: 'checkbox' }), isMessageVisible && (_jsxs(_Fragment, { children: [children, _jsx(Child, { label: 'hello' })] }))] }));
|
|
9
|
+
}
|
|
10
|
+
const StyledDiv = styled.div `
|
|
11
|
+
background: red;
|
|
12
|
+
`;
|
|
13
|
+
export default React.memo(Hidden);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import React from 'react';
|
|
5
|
+
function Child({ children, className, label }) {
|
|
6
|
+
return (_jsxs("div", { className: className, children: [label || '', children] }));
|
|
7
|
+
}
|
|
8
|
+
export default React.memo(Child);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/** This should appear as-is in the output with: 1. extension added, 2. augmented.d.ts correct */
|
|
4
|
+
import './augmented.js';
|
|
5
|
+
/** This import should appear as-in in the ouput (cjs without asserts) */
|
|
6
|
+
import testJson from '@pezkuwi/dev/rootJs/testJson.json' with { type: 'json' };
|
|
7
|
+
/** Double double work, i.e. re-exports */
|
|
8
|
+
export { Clazz } from './Clazz.js';
|
|
9
|
+
/** Function to ensure that BigInt does not have the Babel Math.pow() transform */
|
|
10
|
+
export function bigIntExp() {
|
|
11
|
+
// 123_456n * 137_858_491_849n
|
|
12
|
+
return 123456789n * (13n ** 10n);
|
|
13
|
+
}
|
|
14
|
+
/** Function to ensure that dynamic imports work */
|
|
15
|
+
export async function dynamic(a, b) {
|
|
16
|
+
// NOTE we go via this path so it points to the same location in both ESM
|
|
17
|
+
// and CJS output (a './dynamic' import would be different otherwise)
|
|
18
|
+
const { sum } = await import('@pezkuwi/dev/rootJs/dynamic.mjs');
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
20
|
+
return sum(a, b);
|
|
21
|
+
}
|
|
22
|
+
/** Function to ensure we have json correctly imported */
|
|
23
|
+
export function json() {
|
|
24
|
+
return testJson.test.json;
|
|
25
|
+
}
|
|
26
|
+
/** Check support for the ?? operator */
|
|
27
|
+
export function jsOpExp(a) {
|
|
28
|
+
const defaults = {
|
|
29
|
+
a: 42,
|
|
30
|
+
b: 43,
|
|
31
|
+
c: 44
|
|
32
|
+
};
|
|
33
|
+
return a ?? defaults.a;
|
|
34
|
+
}
|
|
35
|
+
/** This is an actual check to ensure PURE is all-happy */
|
|
36
|
+
export const pureOpExp = /*#__PURE__*/ jsOpExp();
|
|
37
|
+
const fooA = 1;
|
|
38
|
+
const fooB = 2;
|
|
39
|
+
const fooC = 3;
|
|
40
|
+
const fooD = 4;
|
|
41
|
+
export { fooA, fooB, fooC, fooD };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export function runTests({ Clazz, TEST_PURE, bigIntExp, dynamic, jsOpExp, json }) {
|
|
4
|
+
describe('Clazz', () => {
|
|
5
|
+
it('has staticProperty', () => {
|
|
6
|
+
expect(Clazz.staticProperty).toBe('foobar');
|
|
7
|
+
});
|
|
8
|
+
it('creates an instance with get/set', () => {
|
|
9
|
+
const c = new Clazz(456);
|
|
10
|
+
expect(c.something).toBe(123_456_789 & 456);
|
|
11
|
+
c.setSomething(123);
|
|
12
|
+
expect(c.something).toBe(123 & 456);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
describe('TEST_PURE', () => {
|
|
16
|
+
it('should have the correct value', () => {
|
|
17
|
+
expect(TEST_PURE).toBe('testRoot');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe('dynamic()', () => {
|
|
21
|
+
it('should allow dynamic import usage', async () => {
|
|
22
|
+
expect(await dynamic(5, 37)).toBe(42);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe('bigIntExp()', () => {
|
|
26
|
+
it('should return the correct value', () => {
|
|
27
|
+
expect(bigIntExp()).toBe(123456789n * 137858491849n);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('jsOpExp', () => {
|
|
31
|
+
it('handles 0 ?? 42 correctly', () => {
|
|
32
|
+
expect(jsOpExp(0)).toBe(0);
|
|
33
|
+
});
|
|
34
|
+
it('handles undefined ?? 42 correctly', () => {
|
|
35
|
+
expect(jsOpExp()).toBe(42);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('json()', () => {
|
|
39
|
+
it('should return the correct value', () => {
|
|
40
|
+
expect(json()).toBe('works');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|