@fougere/decorators 0.6.0-alpha.0 → 0.8.0-alpha.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/dist/index.d.ts +1 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TC39 Stage 3 decorator — marks a class or method as part of the frond's
|
|
3
|
-
* public contract.
|
|
4
|
-
*
|
|
5
|
-
* On a class: sets `__exposed = true` (readable via `isExposed()`).
|
|
6
|
-
* On a method: collects method name in a WeakMap keyed by class (readable via `getExposedMethods()`).
|
|
7
|
-
*
|
|
8
|
-
* This is syntactic sugar — the source of truth for exposure can also be
|
|
9
|
-
* `defineFrond({ expose: [...] })` in `frond.config.ts`, which takes precedence.
|
|
10
|
-
*/
|
|
1
|
+
/** TC39 Stage 3 decorator — marks a class or method as part of the frond's public contract. */
|
|
11
2
|
export declare function expose(target: Function, context: ClassDecoratorContext): void;
|
|
12
3
|
export declare function expose(target: Function, context: ClassMethodDecoratorContext): void;
|
|
13
4
|
/** Check whether a class has been marked with `@expose`. */
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAI/F,wBAAgB,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAC;AAC/E,wBAAgB,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC;AAqBrF,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAEhD;AAED,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CAM5D"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TC39 Stage 3 decorator — marks a class or method as part of the frond's
|
|
3
|
-
* public contract.
|
|
4
|
-
*
|
|
5
|
-
* On a class: sets `__exposed = true` (readable via `isExposed()`).
|
|
6
|
-
* On a method: collects method name in a WeakMap keyed by class (readable via `getExposedMethods()`).
|
|
7
|
-
*
|
|
8
|
-
* This is syntactic sugar — the source of truth for exposure can also be
|
|
9
|
-
* `defineFrond({ expose: [...] })` in `frond.config.ts`, which takes precedence.
|
|
10
|
-
*/
|
|
1
|
+
/** TC39 Stage 3 decorator — marks a class or method as part of the frond's public contract. */
|
|
11
2
|
const exposedMethods = new WeakMap();
|
|
12
3
|
export function expose(target, context) {
|
|
13
4
|
if (context.kind === 'class') {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAE/F,MAAM,cAAc,GAAG,IAAI,OAAO,EAAuB,CAAC;AAI1D,MAAM,UAAU,MAAM,CACpB,MAAgB,EAChB,OAA4D;IAE5D,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,MAAkC,CAAC,SAAS,GAAG,IAAI,CAAC;IACvD,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,CAAC,cAAc,CAAC;YACrB,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;YAC9B,IAAI,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;gBAChB,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAChC,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAc,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,SAAS,CAAC,GAAa;IACrC,OAAQ,GAAW,CAAC,SAAS,KAAK,IAAI,CAAC;AACzC,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,GAAa;IAC7C,2CAA2C;IAC3C,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,IAAI,CAAC;YAAC,IAAK,GAAW,EAAE,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,EAAU,CAAC;AACtD,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TC39 Stage 3 decorator — marks a class or method as part of the frond's
|
|
3
|
-
* public contract.
|
|
4
|
-
*
|
|
5
|
-
* On a class: sets `__exposed = true` (readable via `isExposed()`).
|
|
6
|
-
* On a method: collects method name in a WeakMap keyed by class (readable via `getExposedMethods()`).
|
|
7
|
-
*
|
|
8
|
-
* This is syntactic sugar — the source of truth for exposure can also be
|
|
9
|
-
* `defineFrond({ expose: [...] })` in `frond.config.ts`, which takes precedence.
|
|
10
|
-
*/
|
|
1
|
+
/** TC39 Stage 3 decorator — marks a class or method as part of the frond's public contract. */
|
|
11
2
|
|
|
12
3
|
const exposedMethods = new WeakMap<object, Set<string>>();
|
|
13
4
|
|
|
@@ -18,7 +9,7 @@ export function expose(
|
|
|
18
9
|
context: ClassDecoratorContext | ClassMethodDecoratorContext,
|
|
19
10
|
): void {
|
|
20
11
|
if (context.kind === 'class') {
|
|
21
|
-
(target as
|
|
12
|
+
(target as { __exposed?: boolean }).__exposed = true;
|
|
22
13
|
}
|
|
23
14
|
if (context.kind === 'method') {
|
|
24
15
|
context.addInitializer(function (this: any) {
|