piral-ng 1.9.1-beta.8340 → 1.9.1-beta.8341
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/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/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/utils.d.ts
CHANGED
|
@@ -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;IACnB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM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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.8341",
|
|
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.8341",
|
|
75
75
|
"piral-ng-common": "^16.0.0",
|
|
76
76
|
"rxjs": "^7.3.0"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "b92cc75db5a1d4bc256f379ca1db28b3734a68cb"
|
|
79
79
|
}
|
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> {
|