@deenruv/ui-devkit 1.0.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/LICENSE +23 -0
- package/README.md +5 -0
- package/client/devkit-client-api.d.ts +109 -0
- package/client/index.d.ts +1 -0
- package/client/index.js +1 -0
- package/compiler/compile.d.ts +9 -0
- package/compiler/compile.js +265 -0
- package/compiler/compile.js.map +1 -0
- package/compiler/constants.d.ts +6 -0
- package/compiler/constants.js +10 -0
- package/compiler/constants.js.map +1 -0
- package/compiler/helpers.d.ts +25 -0
- package/compiler/helpers.js +50 -0
- package/compiler/helpers.js.map +1 -0
- package/compiler/index.d.ts +3 -0
- package/compiler/index.js +20 -0
- package/compiler/index.js.map +1 -0
- package/compiler/scaffold.d.ts +4 -0
- package/compiler/scaffold.js +259 -0
- package/compiler/scaffold.js.map +1 -0
- package/compiler/translations.d.ts +12 -0
- package/compiler/translations.js +135 -0
- package/compiler/translations.js.map +1 -0
- package/compiler/types.d.ts +454 -0
- package/compiler/types.js +3 -0
- package/compiler/types.js.map +1 -0
- package/compiler/utils.d.ts +34 -0
- package/compiler/utils.js +139 -0
- package/compiler/utils.js.map +1 -0
- package/package.json +66 -0
- package/scaffold/README.md +7 -0
- package/scaffold/angular.json +128 -0
- package/scaffold/package.json +11 -0
- package/scaffold/src/app.module.ts +23 -0
- package/scaffold/src/app.routes.ts +63 -0
- package/scaffold/src/environment.prod.ts +3 -0
- package/scaffold/src/environment.ts +6 -0
- package/scaffold/src/extension.routes.ts +1 -0
- package/scaffold/src/main.ts +16 -0
- package/scaffold/src/shared-extensions.module.ts +7 -0
- package/scaffold/src/styles/global-styles.scss +1 -0
- package/scaffold/src/tsconfig.app.json +18 -0
- package/scaffold/tsconfig.json +28 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# License 1
|
|
2
|
+
|
|
3
|
+
The MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2025-present Aexol
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
12
|
+
|
|
13
|
+
# License 2
|
|
14
|
+
|
|
15
|
+
The MIT License
|
|
16
|
+
|
|
17
|
+
Copyright (c) 2018-2025 Michael Bromley
|
|
18
|
+
|
|
19
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ActiveRouteData, NotificationMessage, WatchQueryFetchPolicy } from "@deenruv/common/lib/extension-host-types";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* Set the [window.postMessage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
|
|
6
|
+
* `targetOrigin`. The Deenruv ui-devkit uses the postMessage API to
|
|
7
|
+
* enable cross-frame and cross-origin communication between the ui extension code and the Admin UI
|
|
8
|
+
* app. The `targetOrigin` is a security feature intended to provide control over where messages are sent.
|
|
9
|
+
*
|
|
10
|
+
* @docsCategory ui-devkit
|
|
11
|
+
* @docsPage UiDevkitClient
|
|
12
|
+
*/
|
|
13
|
+
export declare function setTargetOrigin(value: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* @description
|
|
16
|
+
* Retrieves information about the current route of the host application, since it is not possible
|
|
17
|
+
* to otherwise get this information from within the child iframe.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { getActivatedRoute } from '\@deenruv/ui-devkit';
|
|
22
|
+
*
|
|
23
|
+
* const route = await getActivatedRoute();
|
|
24
|
+
* const slug = route.params.slug;
|
|
25
|
+
* ```
|
|
26
|
+
* @docsCategory ui-devkit
|
|
27
|
+
* @docsPage UiDevkitClient
|
|
28
|
+
*/
|
|
29
|
+
export declare function getActivatedRoute(): Promise<ActiveRouteData>;
|
|
30
|
+
/**
|
|
31
|
+
* @description
|
|
32
|
+
* Perform a GraphQL query and returns either an Observable or a Promise of the result.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { graphQlQuery } from '\@deenruv/ui-devkit';
|
|
37
|
+
*
|
|
38
|
+
* const productList = await graphQlQuery(`
|
|
39
|
+
* query GetProducts($skip: Int, $take: Int) {
|
|
40
|
+
* products(options: { skip: $skip, take: $take }) {
|
|
41
|
+
* items { id, name, enabled },
|
|
42
|
+
* totalItems
|
|
43
|
+
* }
|
|
44
|
+
* }`, {
|
|
45
|
+
* skip: 0,
|
|
46
|
+
* take: 10,
|
|
47
|
+
* }).then(data => data.products);
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @docsCategory ui-devkit
|
|
51
|
+
* @docsPage UiDevkitClient
|
|
52
|
+
*/
|
|
53
|
+
export declare function graphQlQuery<T, V extends {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}>(document: string, variables?: {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}, fetchPolicy?: WatchQueryFetchPolicy): {
|
|
58
|
+
then: Promise<T>["then"];
|
|
59
|
+
stream: Observable<T>;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* @description
|
|
63
|
+
* Perform a GraphQL mutation and returns either an Observable or a Promise of the result.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { graphQlMutation } from '\@deenruv/ui-devkit';
|
|
68
|
+
*
|
|
69
|
+
* const disableProduct = (id: string) => {
|
|
70
|
+
* return graphQlMutation(`
|
|
71
|
+
* mutation DisableProduct($id: ID!) {
|
|
72
|
+
* updateProduct(input: { id: $id, enabled: false }) {
|
|
73
|
+
* id
|
|
74
|
+
* enabled
|
|
75
|
+
* }
|
|
76
|
+
* }`, { id })
|
|
77
|
+
* .then(data => data.updateProduct)
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @docsCategory ui-devkit
|
|
82
|
+
* @docsPage UiDevkitClient
|
|
83
|
+
*/
|
|
84
|
+
export declare function graphQlMutation<T, V extends {
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}>(document: string, variables?: {
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}): {
|
|
89
|
+
then: Promise<T>["then"];
|
|
90
|
+
stream: Observable<T>;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* @description
|
|
94
|
+
* Display a toast notification.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { notify } from '\@deenruv/ui-devkit';
|
|
99
|
+
*
|
|
100
|
+
* notify({
|
|
101
|
+
* message: 'Updated Product',
|
|
102
|
+
* type: 'success'
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @docsCategory ui-devkit
|
|
107
|
+
* @docsPage UiDevkitClient
|
|
108
|
+
*/
|
|
109
|
+
export declare function notify(options: NotificationMessage["data"]): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./devkit-client-api";
|
package/client/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).DeenruvUiClient={})}(this,function(t){"use strict";var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},r(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}r(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function e(t){var r="function"==typeof Symbol&&Symbol.iterator,n=r&&t[r],e=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(t,r){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var e,o,i=n.call(t),u=[];try{for(;(void 0===r||r-- >0)&&!(e=i.next()).done;)u.push(e.value)}catch(t){o={error:t}}finally{try{e&&!e.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function i(t,r,n){if(n||2===arguments.length)for(var e,o=0,i=r.length;o<i;o++)!e&&o in r||(e||(e=Array.prototype.slice.call(r,0,o)),e[o]=r[o]);return t.concat(e||Array.prototype.slice.call(r))}function u(t){return"function"==typeof t}"function"==typeof SuppressedError&&SuppressedError;var s,c=((s=function(t){return function(r){t(this),this.message=r?r.length+" errors occurred during unsubscription:\n"+r.map(function(t,r){return r+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=r}}(function(t){Error.call(t),t.stack=(new Error).stack})).prototype=Object.create(Error.prototype),s.prototype.constructor=s,s);function a(t,r){if(t){var n=t.indexOf(r);0<=n&&t.splice(n,1)}}var l=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var r;return t.prototype.unsubscribe=function(){var t,r,n,s,a;if(!this.closed){this.closed=!0;var l=this._parentage;if(l)if(this._parentage=null,Array.isArray(l))try{for(var f=e(l),h=f.next();!h.done;h=f.next()){h.value.remove(this)}}catch(r){t={error:r}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}else l.remove(this);var y=this.initialTeardown;if(u(y))try{y()}catch(t){a=t instanceof c?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=e(d),b=v.next();!b.done;b=v.next()){var m=b.value;try{p(m)}catch(t){a=null!=a?a:[],t instanceof c?a=i(i([],o(a)),o(t.errors)):a.push(t)}}}catch(t){n={error:t}}finally{try{b&&!b.done&&(s=v.return)&&s.call(v)}finally{if(n)throw n.error}}}if(a)throw new c(a)}},t.prototype.add=function(r){var n;if(r&&r!==this)if(this.closed)p(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(r)}},t.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},t.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},t.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&a(r,t)},t.prototype.remove=function(r){var n=this._finalizers;n&&a(n,r),r instanceof t&&r._removeParent(this)},t.EMPTY=((r=new t).closed=!0,r),t}();function f(t){return t instanceof l||t&&"closed"in t&&u(t.remove)&&u(t.add)&&u(t.unsubscribe)}function p(t){u(t)?t():t.unsubscribe()}l.EMPTY;var h={Promise:void 0},y=function(t,r){for(var n=[],e=2;e<arguments.length;e++)n[e-2]=arguments[e];return setTimeout.apply(void 0,i([t,r],o(n)))};function d(){}var v=function(t){function r(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,f(r)&&r.add(n)):n.destination=w,n}return n(r,t),r.create=function(t,r,n){return new m(t,r,n)},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(l),b=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(t){_(t)}},t.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(t){_(t)}else _(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){_(t)}},t}(),m=function(t){function r(r,n,e){var o,i=t.call(this)||this;return o=u(r)||!r?{next:null!=r?r:void 0,error:null!=n?n:void 0,complete:null!=e?e:void 0}:r,i.destination=new b(o),i}return n(r,t),r}(v);function _(t){var r;r=t,y(function(){throw r})}var w={closed:!0,next:d,error:function(t){throw t},complete:d},g="function"==typeof Symbol&&Symbol.observable||"@@observable";function x(t){return t}var S=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(r){var n=new t;return n.source=this,n.operator=r,n},t.prototype.subscribe=function(t,r,n){var e,o=this,i=(e=t)&&e instanceof v||function(t){return t&&u(t.next)&&u(t.error)&&u(t.complete)}(e)&&f(e)?t:new m(t,r,n);return function(){var t=o,r=t.operator,n=t.source;i.add(r?r.call(i,n):n?o._subscribe(i):o._trySubscribe(i))}(),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},t.prototype.forEach=function(t,r){var n=this;return new(r=P(r))(function(r,e){var o=new m({next:function(r){try{t(r)}catch(t){e(t),o.unsubscribe()}},error:e,complete:r});n.subscribe(o)})},t.prototype._subscribe=function(t){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(t)},t.prototype[g]=function(){return this},t.prototype.pipe=function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return(0===(t=r).length?x:1===t.length?t[0]:function(r){return t.reduce(function(t,r){return r(t)},r)})(this)},t.prototype.toPromise=function(t){var r=this;return new(t=P(t))(function(t,n){var e;r.subscribe(function(t){return e=t},function(t){return n(t)},function(){return t(e)})})},t.create=function(r){return new t(r)},t}();function P(t){var r;return null!==(r=null!=t?t:h.Promise)&&void 0!==r?r:Promise}function O(t){return function(r){if(function(t){return u(null==t?void 0:t.lift)}(r))return r.lift(function(r){try{return t(r,this)}catch(t){this.error(t)}});throw new TypeError("Unable to lift unknown Observable type")}}var E=function(t){function r(r,n,e,o,i,u){var s=t.call(this,r)||this;return s.onFinalize=i,s.shouldUnsubscribe=u,s._next=n?function(t){try{n(t)}catch(t){r.error(t)}}:t.prototype._next,s._error=o?function(t){try{o(t)}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._error,s._complete=e?function(){try{e()}catch(t){r.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,s}return n(r,t),r.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(r=this.onFinalize)||void 0===r||r.call(this))}},r}(v),A=new S(function(t){return t.complete()});function T(t){return t<=0?function(){return A}:O(function(r,n){var e,o,i,u=0;r.subscribe(new E(n,function(r){++u<=t&&(n.next(r),t<=u&&n.complete())},e,o,i))})}var z="http://localhost:3000";function j(t,r){var n=t+"__"+Math.random().toString(36).substr(3),e={requestId:n,type:t,data:r};return new S(function(t){var r=window.opener||window.parent,o=function(){r.postMessage({requestId:n,type:"cancellation",data:null},z)};return window.addEventListener("message",function(r){var e=r.data;if(e&&e.requestId===n){if(e.complete)return t.complete(),void o();if(e.error)return t.error(e.data),void o();t.next(e.data)}}),r.postMessage(e,z),o})}t.getActivatedRoute=function(){return j("active-route",{}).toPromise()},t.graphQlMutation=function(t,r){var n=j("graphql-mutation",{document:t,variables:r});return{then:function(){for(var t,r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return(t=n.pipe(T(1)).toPromise()).then.apply(t,r)},stream:n}},t.graphQlQuery=function(t,r,n){var e=j("graphql-query",{document:t,variables:r,fetchPolicy:n});return{then:function(){for(var t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return(t=e.pipe(T(1)).toPromise()).then.apply(t,r)},stream:e}},t.notify=function(t){j("notification",t).toPromise()},t.setTargetOrigin=function(t){z=t}});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AdminUiAppConfig, AdminUiAppDevModeConfig } from "@deenruv/common/lib/shared-types";
|
|
2
|
+
import { UiExtensionCompilerOptions } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* Compiles the Admin UI app with the specified extensions.
|
|
6
|
+
*
|
|
7
|
+
* @docsCategory UiDevkit
|
|
8
|
+
*/
|
|
9
|
+
export declare function compileUiExtensions(options: UiExtensionCompilerOptions): AdminUiAppConfig | AdminUiAppDevModeConfig;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.compileUiExtensions = void 0;
|
|
27
|
+
const child_process_1 = require("child_process");
|
|
28
|
+
const chokidar_1 = require("chokidar");
|
|
29
|
+
const fs = __importStar(require("fs-extra"));
|
|
30
|
+
const path = __importStar(require("path"));
|
|
31
|
+
const constants_1 = require("./constants");
|
|
32
|
+
const scaffold_1 = require("./scaffold");
|
|
33
|
+
const translations_1 = require("./translations");
|
|
34
|
+
const utils_1 = require("./utils");
|
|
35
|
+
/**
|
|
36
|
+
* @description
|
|
37
|
+
* Compiles the Admin UI app with the specified extensions.
|
|
38
|
+
*
|
|
39
|
+
* @docsCategory UiDevkit
|
|
40
|
+
*/
|
|
41
|
+
function compileUiExtensions(options) {
|
|
42
|
+
const { devMode, watchPort } = options;
|
|
43
|
+
const command = options.command && ["npm", "pnpm"].includes(options.command)
|
|
44
|
+
? options.command
|
|
45
|
+
: (0, utils_1.determinePackageManager)();
|
|
46
|
+
if (devMode) {
|
|
47
|
+
return runWatchMode({
|
|
48
|
+
watchPort: watchPort || 4200,
|
|
49
|
+
...options,
|
|
50
|
+
command,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return runCompileMode({
|
|
55
|
+
...options,
|
|
56
|
+
command,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.compileUiExtensions = compileUiExtensions;
|
|
61
|
+
function runCompileMode({ outputPath, baseHref, extensions, command, additionalProcessArguments, ngCompilerPath, }) {
|
|
62
|
+
const distPath = path.join(outputPath, "dist");
|
|
63
|
+
const compile = () => new Promise(async (resolve, reject) => {
|
|
64
|
+
await (0, scaffold_1.setupScaffold)(outputPath, extensions);
|
|
65
|
+
await (0, scaffold_1.setBaseHref)(outputPath, baseHref || constants_1.DEFAULT_BASE_HREF);
|
|
66
|
+
let cmd = command;
|
|
67
|
+
let commandArgs = ["run", "build"];
|
|
68
|
+
if (ngCompilerPath) {
|
|
69
|
+
cmd = "node";
|
|
70
|
+
commandArgs = [ngCompilerPath, "build", "--configuration production"];
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
if (cmd === "npm") {
|
|
74
|
+
// npm requires `--` before any command line args being passed to a script
|
|
75
|
+
commandArgs.splice(2, 0, "--");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
console.log(`Running ${cmd} ${commandArgs.join(" ")}`);
|
|
79
|
+
const buildProcess = (0, child_process_1.spawn)(cmd, [...commandArgs, ...buildProcessArguments(additionalProcessArguments)], {
|
|
80
|
+
cwd: outputPath,
|
|
81
|
+
shell: true,
|
|
82
|
+
stdio: "inherit",
|
|
83
|
+
});
|
|
84
|
+
buildProcess.on("close", (code) => {
|
|
85
|
+
if (code !== 0) {
|
|
86
|
+
reject(code);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
resolve();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
path: distPath,
|
|
95
|
+
compile,
|
|
96
|
+
route: baseHrefToRoute(baseHref || constants_1.DEFAULT_BASE_HREF),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function runWatchMode({ outputPath, baseHref, watchPort, extensions, command, additionalProcessArguments, ngCompilerPath, }) {
|
|
100
|
+
const devkitPath = require.resolve("@deenruv/ui-devkit");
|
|
101
|
+
let buildProcess;
|
|
102
|
+
let watcher;
|
|
103
|
+
let close = () => {
|
|
104
|
+
/* */
|
|
105
|
+
};
|
|
106
|
+
const compile = () => new Promise(async (resolve, reject) => {
|
|
107
|
+
await (0, scaffold_1.setupScaffold)(outputPath, extensions);
|
|
108
|
+
await (0, scaffold_1.setBaseHref)(outputPath, baseHref || constants_1.DEFAULT_BASE_HREF);
|
|
109
|
+
const adminUiExtensions = extensions.filter(utils_1.isAdminUiExtension);
|
|
110
|
+
const normalizedExtensions = (0, utils_1.normalizeExtensions)(adminUiExtensions);
|
|
111
|
+
const globalStylesExtensions = extensions.filter(utils_1.isGlobalStylesExtension);
|
|
112
|
+
const staticAssetExtensions = extensions.filter(utils_1.isStaticAssetExtension);
|
|
113
|
+
const allTranslationFiles = (0, translations_1.getAllTranslationFiles)(extensions.filter(utils_1.isTranslationExtension));
|
|
114
|
+
let cmd = command;
|
|
115
|
+
let commandArgs = ["run", "start"];
|
|
116
|
+
if (ngCompilerPath) {
|
|
117
|
+
cmd = "node";
|
|
118
|
+
commandArgs = [ngCompilerPath, "serve"];
|
|
119
|
+
}
|
|
120
|
+
buildProcess = (0, child_process_1.spawn)(cmd, [
|
|
121
|
+
...commandArgs,
|
|
122
|
+
`--port=${watchPort || 4200}`,
|
|
123
|
+
...buildProcessArguments(additionalProcessArguments),
|
|
124
|
+
], {
|
|
125
|
+
cwd: outputPath,
|
|
126
|
+
shell: true,
|
|
127
|
+
stdio: "inherit",
|
|
128
|
+
});
|
|
129
|
+
buildProcess.on("close", (code) => {
|
|
130
|
+
if (code !== 0) {
|
|
131
|
+
reject(code);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
resolve();
|
|
135
|
+
}
|
|
136
|
+
close();
|
|
137
|
+
});
|
|
138
|
+
for (const extension of normalizedExtensions) {
|
|
139
|
+
if (!watcher) {
|
|
140
|
+
watcher = (0, chokidar_1.watch)(extension.extensionPath, {
|
|
141
|
+
depth: 4,
|
|
142
|
+
ignored: "**/node_modules/",
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
watcher.add(extension.extensionPath);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
for (const extension of staticAssetExtensions) {
|
|
150
|
+
for (const staticAssetDef of extension.staticAssets) {
|
|
151
|
+
const assetPath = (0, utils_1.getStaticAssetPath)(staticAssetDef);
|
|
152
|
+
if (!watcher) {
|
|
153
|
+
watcher = (0, chokidar_1.watch)(assetPath);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
watcher.add(assetPath);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
for (const extension of globalStylesExtensions) {
|
|
161
|
+
const globalStylePaths = Array.isArray(extension.globalStyles)
|
|
162
|
+
? extension.globalStyles
|
|
163
|
+
: [extension.globalStyles];
|
|
164
|
+
for (const stylePath of globalStylePaths) {
|
|
165
|
+
if (!watcher) {
|
|
166
|
+
watcher = (0, chokidar_1.watch)(stylePath);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
watcher.add(stylePath);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
for (const translationFiles of Object.values(allTranslationFiles)) {
|
|
174
|
+
if (!translationFiles) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
for (const file of translationFiles) {
|
|
178
|
+
if (!watcher) {
|
|
179
|
+
watcher = (0, chokidar_1.watch)(file);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
watcher.add(file);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (watcher) {
|
|
187
|
+
// watch the ui-devkit package files too
|
|
188
|
+
watcher.add(devkitPath);
|
|
189
|
+
}
|
|
190
|
+
if (watcher) {
|
|
191
|
+
const allStaticAssetDefs = staticAssetExtensions.reduce((defs, e) => [...defs, ...(e.staticAssets || [])], []);
|
|
192
|
+
const allGlobalStyles = globalStylesExtensions.reduce((defs, e) => [
|
|
193
|
+
...defs,
|
|
194
|
+
...(Array.isArray(e.globalStyles)
|
|
195
|
+
? e.globalStyles
|
|
196
|
+
: [e.globalStyles]),
|
|
197
|
+
], []);
|
|
198
|
+
watcher.on("change", async (filePath) => {
|
|
199
|
+
const extension = normalizedExtensions.find((e) => filePath.includes(e.extensionPath));
|
|
200
|
+
if (extension) {
|
|
201
|
+
const outputDir = path.join(outputPath, constants_1.MODULES_OUTPUT_DIR, extension.id);
|
|
202
|
+
const filePart = path.relative(extension.extensionPath, filePath);
|
|
203
|
+
const dest = path.join(outputDir, filePart);
|
|
204
|
+
await fs.copyFile(filePath, dest);
|
|
205
|
+
}
|
|
206
|
+
if (filePath.includes(devkitPath)) {
|
|
207
|
+
(0, utils_1.copyUiDevkit)(outputPath);
|
|
208
|
+
}
|
|
209
|
+
for (const staticAssetDef of allStaticAssetDefs) {
|
|
210
|
+
const assetPath = (0, utils_1.getStaticAssetPath)(staticAssetDef);
|
|
211
|
+
if (filePath.includes(assetPath)) {
|
|
212
|
+
await (0, utils_1.copyStaticAsset)(outputPath, staticAssetDef);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
for (const stylePath of allGlobalStyles) {
|
|
217
|
+
if (filePath.includes(stylePath)) {
|
|
218
|
+
await (0, scaffold_1.copyGlobalStyleFile)(outputPath, stylePath);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
for (const languageCode of Object.keys(allTranslationFiles)) {
|
|
223
|
+
const translationFiles = allTranslationFiles[languageCode];
|
|
224
|
+
for (const file of translationFiles) {
|
|
225
|
+
if (filePath.includes(path.normalize(file))) {
|
|
226
|
+
await (0, translations_1.mergeExtensionTranslations)(outputPath, {
|
|
227
|
+
[languageCode]: translationFiles,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
resolve();
|
|
235
|
+
});
|
|
236
|
+
close = () => {
|
|
237
|
+
if (watcher) {
|
|
238
|
+
void watcher.close();
|
|
239
|
+
}
|
|
240
|
+
if (buildProcess) {
|
|
241
|
+
buildProcess.kill();
|
|
242
|
+
}
|
|
243
|
+
process.exit();
|
|
244
|
+
};
|
|
245
|
+
process.on("SIGINT", close);
|
|
246
|
+
return {
|
|
247
|
+
sourcePath: outputPath,
|
|
248
|
+
port: watchPort || 4200,
|
|
249
|
+
compile,
|
|
250
|
+
route: baseHrefToRoute(baseHref || constants_1.DEFAULT_BASE_HREF),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function buildProcessArguments(args) {
|
|
254
|
+
return (args ?? []).map((arg) => {
|
|
255
|
+
if (Array.isArray(arg)) {
|
|
256
|
+
const [key, value] = arg;
|
|
257
|
+
return `${key}=${value}`;
|
|
258
|
+
}
|
|
259
|
+
return arg;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function baseHrefToRoute(baseHref) {
|
|
263
|
+
return baseHref.replace(/^\//, "").replace(/\/$/, "");
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=compile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compiler/compile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,iDAAoD;AACpD,uCAA6D;AAC7D,6CAA+B;AAC/B,2CAA6B;AAE7B,2CAAoE;AACpE,yCAA6E;AAC7E,iDAGwB;AAOxB,mCAUiB;AAEjB;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,OAAmC;IAEnC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACvC,MAAM,OAAO,GACX,OAAO,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1D,CAAC,CAAC,OAAO,CAAC,OAAO;QACjB,CAAC,CAAC,IAAA,+BAAuB,GAAE,CAAC;IAChC,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,YAAY,CAAC;YAClB,SAAS,EAAE,SAAS,IAAI,IAAI;YAC5B,GAAG,OAAO;YACV,OAAO;SACR,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,cAAc,CAAC;YACpB,GAAG,OAAO;YACV,OAAO;SACR,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AApBD,kDAoBC;AAED,SAAS,cAAc,CAAC,EACtB,UAAU,EACV,QAAQ,EACR,UAAU,EACV,OAAO,EACP,0BAA0B,EAC1B,cAAc,GAGf;IACC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAE/C,MAAM,OAAO,GAAG,GAAG,EAAE,CACnB,IAAI,OAAO,CAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,IAAA,wBAAa,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OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC;YAEzB,OAAO,GAAG,GAAG,IAAI,KAAe,EAAE,CAAC;QACrC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACvC,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const STATIC_ASSETS_OUTPUT_DIR = "static-assets";
|
|
2
|
+
export declare const GLOBAL_STYLES_OUTPUT_DIR = "global-styles";
|
|
3
|
+
export declare const EXTENSION_ROUTES_FILE = "src/extension.routes.ts";
|
|
4
|
+
export declare const SHARED_EXTENSIONS_FILE = "src/shared-extensions.module.ts";
|
|
5
|
+
export declare const MODULES_OUTPUT_DIR = "src/extensions";
|
|
6
|
+
export declare const DEFAULT_BASE_HREF = "/admin/";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_BASE_HREF = exports.MODULES_OUTPUT_DIR = exports.SHARED_EXTENSIONS_FILE = exports.EXTENSION_ROUTES_FILE = exports.GLOBAL_STYLES_OUTPUT_DIR = exports.STATIC_ASSETS_OUTPUT_DIR = void 0;
|
|
4
|
+
exports.STATIC_ASSETS_OUTPUT_DIR = "static-assets";
|
|
5
|
+
exports.GLOBAL_STYLES_OUTPUT_DIR = "global-styles";
|
|
6
|
+
exports.EXTENSION_ROUTES_FILE = "src/extension.routes.ts";
|
|
7
|
+
exports.SHARED_EXTENSIONS_FILE = "src/shared-extensions.module.ts";
|
|
8
|
+
exports.MODULES_OUTPUT_DIR = "src/extensions";
|
|
9
|
+
exports.DEFAULT_BASE_HREF = "/admin/";
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/compiler/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG,eAAe,CAAC;AAC3C,QAAA,wBAAwB,GAAG,eAAe,CAAC;AAC3C,QAAA,qBAAqB,GAAG,yBAAyB,CAAC;AAClD,QAAA,sBAAsB,GAAG,iCAAiC,CAAC;AAC3D,QAAA,kBAAkB,GAAG,gBAAgB,CAAC;AACtC,QAAA,iBAAiB,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BrandingOptions, StaticAssetExtension } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* A helper function to simplify the process of setting custom branding images.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* compileUiExtensions({
|
|
9
|
+
* outputPath: path.join(__dirname, '../admin-ui'),
|
|
10
|
+
* extensions: [
|
|
11
|
+
* setBranding({
|
|
12
|
+
* // This is used as the branding in the top-left above the navigation
|
|
13
|
+
* smallLogoPath: path.join(__dirname, 'images/my-logo-sm.png'),
|
|
14
|
+
* // This is used on the login page
|
|
15
|
+
* largeLogoPath: path.join(__dirname, 'images/my-logo-lg.png'),
|
|
16
|
+
* faviconPath: path.join(__dirname, 'images/my-favicon.ico'),
|
|
17
|
+
* }),
|
|
18
|
+
* ],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @docsCategory UiDevkit
|
|
23
|
+
* @docsPage helpers
|
|
24
|
+
*/
|
|
25
|
+
export declare function setBranding(options: BrandingOptions): StaticAssetExtension;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setBranding = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* A helper function to simplify the process of setting custom branding images.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* compileUiExtensions({
|
|
11
|
+
* outputPath: path.join(__dirname, '../admin-ui'),
|
|
12
|
+
* extensions: [
|
|
13
|
+
* setBranding({
|
|
14
|
+
* // This is used as the branding in the top-left above the navigation
|
|
15
|
+
* smallLogoPath: path.join(__dirname, 'images/my-logo-sm.png'),
|
|
16
|
+
* // This is used on the login page
|
|
17
|
+
* largeLogoPath: path.join(__dirname, 'images/my-logo-lg.png'),
|
|
18
|
+
* faviconPath: path.join(__dirname, 'images/my-favicon.ico'),
|
|
19
|
+
* }),
|
|
20
|
+
* ],
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @docsCategory UiDevkit
|
|
25
|
+
* @docsPage helpers
|
|
26
|
+
*/
|
|
27
|
+
function setBranding(options) {
|
|
28
|
+
const staticAssets = [];
|
|
29
|
+
if (options.smallLogoPath) {
|
|
30
|
+
staticAssets.push({
|
|
31
|
+
path: options.smallLogoPath,
|
|
32
|
+
rename: "logo-top.webp",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (options.largeLogoPath) {
|
|
36
|
+
staticAssets.push({
|
|
37
|
+
path: options.largeLogoPath,
|
|
38
|
+
rename: "logo-login.webp",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (options.faviconPath) {
|
|
42
|
+
staticAssets.push({
|
|
43
|
+
path: options.faviconPath,
|
|
44
|
+
rename: "favicon.ico",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return { staticAssets };
|
|
48
|
+
}
|
|
49
|
+
exports.setBranding = setBranding;
|
|
50
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/compiler/helpers.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,WAAW,CAAC,OAAwB;IAClD,MAAM,YAAY,GAA4B,EAAE,CAAC;IACjD,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1B,YAAY,CAAC,IAAI,CAAC;YAChB,IAAI,EAAE,OAAO,CAAC,aAAa;YAC3B,MAAM,EAAE,eAAe;SACxB,CAAC,CAAC;IACL,CAAC;IACD,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1B,YAAY,CAAC,IAAI,CAAC;YAChB,IAAI,EAAE,OAAO,CAAC,aAAa;YAC3B,MAAM,EAAE,iBAAiB;SAC1B,CAAC,CAAC;IACL,CAAC;IACD,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,YAAY,CAAC,IAAI,CAAC;YAChB,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,MAAM,EAAE,aAAa;SACtB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC;AArBD,kCAqBC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./compile"), exports);
|
|
18
|
+
__exportStar(require("./helpers"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/compiler/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,0CAAwB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Extension } from "./types";
|
|
2
|
+
export declare function setupScaffold(outputPath: string, extensions: Extension[]): Promise<void>;
|
|
3
|
+
export declare function copyGlobalStyleFile(outputPath: string, stylePath: string): Promise<void>;
|
|
4
|
+
export declare function setBaseHref(outputPath: string, baseHref: string): Promise<void>;
|