piral-ng 1.9.1-beta.8340 → 1.9.1-beta.8345
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/README.md +1 -68
- package/lib/startup.d.ts +1 -1
- package/lib/startup.js +8 -5
- package/lib/startup.js.map +1 -1
- package/lib/utils.d.ts +2 -1
- package/lib/utils.js +8 -2
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/startup.ts +9 -7
- package/src/utils.ts +13 -3
package/README.md
CHANGED
|
@@ -246,74 +246,7 @@ export class AngularPage { /* ... */ }
|
|
|
246
246
|
|
|
247
247
|
where you may need to tell your bundler how to treat these HTML files (i.e., transform these references to strings directly in the bundle).
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
```js
|
|
252
|
-
const { AngularWebpackPlugin } = require('@ngtools/webpack');
|
|
253
|
-
const CopyPlugin = require("copy-webpack-plugin");
|
|
254
|
-
const { resolve } = require("path");
|
|
255
|
-
|
|
256
|
-
module.exports = (config) => {
|
|
257
|
-
config.module.rules.filter(m => m.test.toString() === /\.css$/i.toString()).forEach(m => {
|
|
258
|
-
m.exclude = /\.component.css$/i;
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
config.module.rules.filter(m => m.test.toString() === /\.s[ac]ss$/i.toString()).forEach(m => {
|
|
262
|
-
m.exclude = /\.component.s[ac]ss$/i;
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
const cssLoaderNoModule = {
|
|
266
|
-
loader: require.resolve('css-loader'),
|
|
267
|
-
options: {
|
|
268
|
-
esModule: false,
|
|
269
|
-
},
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
const htmlLoaderNoModule = {
|
|
273
|
-
loader: require.resolve('html-loader'),
|
|
274
|
-
options: {
|
|
275
|
-
esModule: false,
|
|
276
|
-
},
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
const ruleIndex = config.module.rules.findIndex(m => m.test.toString() === /\.tsx?$/i.toString());
|
|
280
|
-
|
|
281
|
-
config.module.rules.splice(ruleIndex, 1,
|
|
282
|
-
{
|
|
283
|
-
test: /\.[jt]sx?$/,
|
|
284
|
-
loader: '@ngtools/webpack',
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
test: /\.component.html$/i,
|
|
288
|
-
use: ["to-string-loader", htmlLoaderNoModule],
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
test: /\.component.css$/i,
|
|
292
|
-
use: ["to-string-loader", cssLoaderNoModule],
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
test: /\.component.s[ac]ss$/i,
|
|
296
|
-
use: ["to-string-loader", cssLoaderNoModule, "sass-loader"],
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
config.plugins.push(
|
|
300
|
-
new AngularWebpackPlugin({
|
|
301
|
-
tsconfig: 'tsconfig.json',
|
|
302
|
-
jitMode: true,
|
|
303
|
-
}),
|
|
304
|
-
new CopyPlugin({
|
|
305
|
-
patterns: [
|
|
306
|
-
{ from: resolve(__dirname, "src/assets") },
|
|
307
|
-
],
|
|
308
|
-
}),
|
|
309
|
-
)
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return config;
|
|
313
|
-
};
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
**Note**: You must install these dependencies (also things like `copy-webpack-plugin`) yourself. `piral-ng` does not come with any dependencies for development.
|
|
249
|
+
The standard bundler configuration can be done with `piral-ng/extend-webpack`. More information can be seen in the [Converting an Angular Application to a Pilet](#converting-an-angular-application-to-a-pilet) section.
|
|
317
250
|
:::
|
|
318
251
|
|
|
319
252
|
::: summary: Legacy Use
|
package/lib/startup.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentContext } from 'piral-core';
|
|
2
|
-
import type { NgModuleFlags, NgOptions } from './types';
|
|
3
2
|
import { NgModuleRef } from '@angular/core';
|
|
3
|
+
import type { NgModuleFlags, NgOptions } from './types';
|
|
4
4
|
export type NgModuleInt = NgModuleRef<any> & {
|
|
5
5
|
_destroyed: boolean;
|
|
6
6
|
};
|
package/lib/startup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as browserDynamic from '@angular/platform-browser-dynamic';
|
|
2
|
-
import { enableProdMode, NgZone, ɵALLOW_MULTIPLE_PLATFORMS as ALLOW_MULTIPLE_PLATFORMS, VERSION, } from '@angular/core';
|
|
3
2
|
import { APP_BASE_HREF } from '@angular/common';
|
|
3
|
+
import { enableProdMode, NgZone, ɵALLOW_MULTIPLE_PLATFORMS as ALLOW_MULTIPLE_PLATFORMS, VERSION, } from '@angular/core';
|
|
4
4
|
import { contextName } from './constants';
|
|
5
5
|
import { CONTEXT } from './injection';
|
|
6
6
|
import { getNgVersion } from './utils';
|
|
@@ -55,10 +55,13 @@ function startNew(BootstrapModule, context, ngOptions, ngFlags) {
|
|
|
55
55
|
export function teardown(BootstrapModule) {
|
|
56
56
|
const runningModuleIndex = runningModules.findIndex(([ref]) => ref === BootstrapModule);
|
|
57
57
|
if (runningModuleIndex !== -1) {
|
|
58
|
-
const [,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
const [, instance] = runningModules[runningModuleIndex];
|
|
59
|
+
try {
|
|
60
|
+
instance.destroy();
|
|
61
|
+
runningModules.splice(runningModuleIndex, 1);
|
|
62
|
+
}
|
|
63
|
+
catch (ex) {
|
|
64
|
+
console.warn('Could not destroy the running Angular module', ex);
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
}
|
package/lib/startup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup.js","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"startup.js","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,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HANGED
|
@@ -8,7 +8,8 @@ export interface NgAnnotation {
|
|
|
8
8
|
declarations: Array<any>;
|
|
9
9
|
entryComponents: Array<any>;
|
|
10
10
|
bootstrap: any;
|
|
11
|
-
selector
|
|
11
|
+
selector?: string;
|
|
12
|
+
selectors?: Array<Array<string>>;
|
|
12
13
|
}
|
|
13
14
|
export declare function getId(): string;
|
|
14
15
|
export declare function getNgVersion(): string;
|
package/lib/utils.js
CHANGED
|
@@ -15,7 +15,7 @@ export function getAnnotations(component) {
|
|
|
15
15
|
annotations = Reflect.getOwnMetadata('annotations', component);
|
|
16
16
|
}
|
|
17
17
|
if (!annotations && typeof component.ɵcmp !== 'undefined') {
|
|
18
|
-
annotations = [
|
|
18
|
+
annotations = [component.ɵcmp];
|
|
19
19
|
}
|
|
20
20
|
if (!annotations && typeof component.ɵmod !== 'undefined') {
|
|
21
21
|
annotations = [component.ɵmod];
|
|
@@ -24,7 +24,13 @@ export function getAnnotations(component) {
|
|
|
24
24
|
}
|
|
25
25
|
export function hasSelector(component, selector) {
|
|
26
26
|
const [annotation] = getAnnotations(component);
|
|
27
|
-
|
|
27
|
+
if (annotation.selector === selector) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (!Array.isArray(annotation.selectors)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return annotation.selectors.some((sels) => sels.includes(selector));
|
|
28
34
|
}
|
|
29
35
|
export function findComponents(exports) {
|
|
30
36
|
const components = [];
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,eAAe,CAAC;AAexD,MAAM,UAAU,KAAK;IAC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C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAmB;IAChD,MAAM,UAAU,GAAG,EAAE,CAAC;IAEtB,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;YACzB,MAAM,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;YAExC,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;oBACvB,UAAU,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;gBACzD,CAAC;qBAAM,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;oBACxD,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-ng",
|
|
3
|
-
"version": "1.9.1-beta.
|
|
3
|
+
"version": "1.9.1-beta.8345",
|
|
4
4
|
"description": "Plugin for integrating Angular components in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"@angular/platform-browser": "^16.0.0",
|
|
72
72
|
"@angular/platform-browser-dynamic": "^16.0.0",
|
|
73
73
|
"@angular/router": "^16.0.0",
|
|
74
|
-
"piral-core": "1.9.1-beta.
|
|
74
|
+
"piral-core": "1.9.1-beta.8345",
|
|
75
75
|
"piral-ng-common": "^16.0.0",
|
|
76
76
|
"rxjs": "^7.3.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "f7e03ea2bbf1519b1abba21b982d80312ab0e2f4"
|
|
79
79
|
}
|
package/src/startup.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentContext } from 'piral-core';
|
|
2
|
-
import type { NgModuleFlags, NgOptions } from './types';
|
|
3
2
|
import * as browserDynamic from '@angular/platform-browser-dynamic';
|
|
3
|
+
import { APP_BASE_HREF } from '@angular/common';
|
|
4
4
|
import {
|
|
5
5
|
enableProdMode,
|
|
6
6
|
NgModuleRef,
|
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
ɵALLOW_MULTIPLE_PLATFORMS as ALLOW_MULTIPLE_PLATFORMS,
|
|
10
10
|
VERSION,
|
|
11
11
|
} from '@angular/core';
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
import { contextName } from './constants';
|
|
14
14
|
import { CONTEXT } from './injection';
|
|
15
15
|
import { getNgVersion } from './utils';
|
|
16
|
+
import type { NgModuleFlags, NgOptions } from './types';
|
|
16
17
|
|
|
17
18
|
const normalCall = 'platformBrowserDynamic';
|
|
18
19
|
const legacyCall = 'ɵplatformCoreDynamic';
|
|
@@ -79,11 +80,12 @@ export function teardown(BootstrapModule: any) {
|
|
|
79
80
|
const runningModuleIndex = runningModules.findIndex(([ref]) => ref === BootstrapModule);
|
|
80
81
|
|
|
81
82
|
if (runningModuleIndex !== -1) {
|
|
82
|
-
const [,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
const [, instance] = runningModules[runningModuleIndex];
|
|
84
|
+
try {
|
|
85
|
+
instance.destroy();
|
|
86
|
+
runningModules.splice(runningModuleIndex, 1);
|
|
87
|
+
} catch (ex) {
|
|
88
|
+
console.warn('Could not destroy the running Angular module', ex);
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
}
|
package/src/utils.ts
CHANGED
|
@@ -9,7 +9,8 @@ export interface NgAnnotation {
|
|
|
9
9
|
declarations: Array<any>;
|
|
10
10
|
entryComponents: Array<any>;
|
|
11
11
|
bootstrap: any;
|
|
12
|
-
selector
|
|
12
|
+
selector?: string;
|
|
13
|
+
selectors?: Array<Array<string>>;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export function getId() {
|
|
@@ -33,7 +34,7 @@ export function getAnnotations(component: any): Array<NgAnnotation> {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
if (!annotations && typeof component.ɵcmp !== 'undefined') {
|
|
36
|
-
annotations = [
|
|
37
|
+
annotations = [component.ɵcmp];
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
if (!annotations && typeof component.ɵmod !== 'undefined') {
|
|
@@ -45,7 +46,16 @@ export function getAnnotations(component: any): Array<NgAnnotation> {
|
|
|
45
46
|
|
|
46
47
|
export function hasSelector(component: any, selector: string) {
|
|
47
48
|
const [annotation] = getAnnotations(component);
|
|
48
|
-
|
|
49
|
+
|
|
50
|
+
if (annotation.selector === selector) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!Array.isArray(annotation.selectors)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return annotation.selectors.some((sels) => sels.includes(selector));
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
export function findComponents(exports: Array<any>): Array<any> {
|