plinth-ui 0.0.4 → 0.0.5

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.
@@ -0,0 +1 @@
1
+ export * from '../dist/angular/index';
@@ -0,0 +1 @@
1
+ export * from '../dist/angular/index.js';
@@ -0,0 +1,2 @@
1
+ import * as d from './components';
2
+ export declare const DIRECTIVES: (typeof d.MyComponent)[];
@@ -0,0 +1,4 @@
1
+ import * as d from './components';
2
+ export const DIRECTIVES = [
3
+ d.MyComponent
4
+ ];
@@ -0,0 +1,6 @@
1
+
2
+ import * as d from './components';
3
+
4
+ export const DIRECTIVES = [
5
+ d.MyComponent
6
+ ];
@@ -1,2 +1,9 @@
1
- import * as d from './components';
2
- export declare const DIRECTIVES: (typeof d.MyComponent)[];
1
+ /**
2
+ * Angular proxies entrypoint.
3
+ *
4
+ * This file is written by scripts/prepare-framework-proxies.cjs
5
+ * and should be committed to the build output only.
6
+ */
7
+ export * from './components';
8
+ export { DIRECTIVES } from './directives';
9
+ export { PlinthUiModule } from './module';
@@ -1,4 +1,9 @@
1
- import * as d from './components';
2
- export const DIRECTIVES = [
3
- d.MyComponent
4
- ];
1
+ /**
2
+ * Angular proxies entrypoint.
3
+ *
4
+ * This file is written by scripts/prepare-framework-proxies.cjs
5
+ * and should be committed to the build output only.
6
+ */
7
+ export * from './components';
8
+ export { DIRECTIVES } from './directives';
9
+ export { PlinthUiModule } from './module';
@@ -1,6 +1,10 @@
1
+ /**
2
+ * Angular proxies entrypoint.
3
+ *
4
+ * This file is written by scripts/prepare-framework-proxies.cjs
5
+ * and should be committed to the build output only.
6
+ */
1
7
 
2
- import * as d from './components';
3
-
4
- export const DIRECTIVES = [
5
- d.MyComponent
6
- ];
8
+ export * from './components';
9
+ export { DIRECTIVES } from './directives';
10
+ export { PlinthUiModule } from './module';
@@ -0,0 +1,2 @@
1
+ export declare class PlinthUiModule {
2
+ }
@@ -0,0 +1,57 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
35
+ import { NgModule } from '@angular/core';
36
+ import { DIRECTIVES } from './directives';
37
+ let PlinthUiModule = (() => {
38
+ let _classDecorators = [NgModule({
39
+ declarations: [...DIRECTIVES],
40
+ exports: [...DIRECTIVES],
41
+ })];
42
+ let _classDescriptor;
43
+ let _classExtraInitializers = [];
44
+ let _classThis;
45
+ var PlinthUiModule = class {
46
+ static { _classThis = this; }
47
+ static {
48
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
49
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
50
+ PlinthUiModule = _classThis = _classDescriptor.value;
51
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
52
+ __runInitializers(_classThis, _classExtraInitializers);
53
+ }
54
+ };
55
+ return PlinthUiModule = _classThis;
56
+ })();
57
+ export { PlinthUiModule };
@@ -0,0 +1,8 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { DIRECTIVES } from './directives';
3
+
4
+ @NgModule({
5
+ declarations: [...DIRECTIVES],
6
+ exports: [...DIRECTIVES],
7
+ })
8
+ export class PlinthUiModule {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plinth-ui",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -45,6 +45,8 @@
45
45
  },
46
46
  "files": [
47
47
  "dist/",
48
+ "angular/",
49
+ "react/",
48
50
  "loader/",
49
51
  "scripts/"
50
52
  ],
@@ -0,0 +1 @@
1
+ export * from '../dist/react/index';
package/react/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../dist/react/index.js';
@@ -7,6 +7,39 @@ function ensureDir(dir) {
7
7
  fs.mkdirSync(dir, { recursive: true });
8
8
  }
9
9
 
10
+ function writeAngularEntrypoints() {
11
+ const angularDistDir = path.join(repoRoot, 'dist', 'angular');
12
+ ensureDir(angularDistDir);
13
+
14
+ const indexTsPath = path.join(angularDistDir, 'index.ts');
15
+ const moduleTsPath = path.join(angularDistDir, 'module.ts');
16
+
17
+ const indexContents = `/**
18
+ * Angular proxies entrypoint.
19
+ *
20
+ * This file is written by scripts/prepare-framework-proxies.cjs
21
+ * and should be committed to the build output only.
22
+ */
23
+
24
+ export * from './components';
25
+ export { DIRECTIVES } from './directives';
26
+ export { PlinthUiModule } from './module';
27
+ `;
28
+
29
+ const moduleContents = `import { NgModule } from '@angular/core';
30
+ import { DIRECTIVES } from './directives';
31
+
32
+ @NgModule({
33
+ declarations: [...DIRECTIVES],
34
+ exports: [...DIRECTIVES],
35
+ })
36
+ export class PlinthUiModule {}
37
+ `;
38
+
39
+ fs.writeFileSync(indexTsPath, indexContents, 'utf8');
40
+ fs.writeFileSync(moduleTsPath, moduleContents, 'utf8');
41
+ }
42
+
10
43
  function writeReactEntrypoint() {
11
44
  const reactDistDir = path.join(repoRoot, 'dist', 'react');
12
45
  ensureDir(reactDistDir);
@@ -42,6 +75,31 @@ function copyAngularUtils() {
42
75
  fs.copyFileSync(src, dest);
43
76
  }
44
77
 
78
+ function writeRootEntrypoints() {
79
+ const angularDir = path.join(repoRoot, 'angular');
80
+ const reactDir = path.join(repoRoot, 'react');
81
+ ensureDir(angularDir);
82
+ ensureDir(reactDir);
83
+
84
+ // These help tools that don't understand package.json "exports"
85
+ // (legacy TS "moduleResolution": "node", some bundlers, etc.)
86
+ fs.writeFileSync(
87
+ path.join(angularDir, 'index.js'),
88
+ `export * from '../dist/angular/index.js';\n`,
89
+ 'utf8'
90
+ );
91
+ fs.writeFileSync(
92
+ path.join(angularDir, 'index.d.ts'),
93
+ `export * from '../dist/angular/index';\n`,
94
+ 'utf8'
95
+ );
96
+
97
+ fs.writeFileSync(path.join(reactDir, 'index.js'), `export * from '../dist/react/index.js';\n`, 'utf8');
98
+ fs.writeFileSync(path.join(reactDir, 'index.d.ts'), `export * from '../dist/react/index';\n`, 'utf8');
99
+ }
100
+
101
+ writeAngularEntrypoints();
45
102
  writeReactEntrypoint();
46
103
  copyAngularUtils();
104
+ writeRootEntrypoints();
47
105