@nstudio/xplat 15.0.4-rc.0 → 15.0.4-rc.1

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 CHANGED
@@ -42,10 +42,12 @@ You are now ready to create apps:
42
42
  nx g app
43
43
  ```
44
44
 
45
- **NOTE:** If you encounter any issue, you can try creating an Nx workspace with version specified, for example:
45
+ **NOTE:** If you encounter any issue, you can try creating an Nx workspace with a version specified.
46
+
47
+ We have tested with the following, for example:
46
48
 
47
49
  ```
48
- npx create-nx-workspace@14.1.7
50
+ npx create-nx-workspace@15.9.2
49
51
  ```
50
52
 
51
53
  ## App generation examples
@@ -262,7 +262,7 @@ function updateRootPackage(tree, context) {
262
262
  json.dependencies = json.dependencies || {};
263
263
  json.dependencies = Object.assign(Object.assign(Object.assign({}, json.dependencies), (hasNativeScriptApps ? nativeScriptDeps : {})), { '@ngx-translate/core': ngxTranslateVersion });
264
264
  let ngToolsDeps = {
265
- '@ngtools/webpack': angularVersion
265
+ '@ngtools/webpack': angularVersion,
266
266
  };
267
267
  if (json.dependencies['@angular/core']) {
268
268
  // make sure in sync with current angular versions
@@ -289,7 +289,7 @@ function default_1() {
289
289
  updateRootPackage,
290
290
  (tree) => {
291
291
  return (0, schematics_1.externalSchematic)('@nrwl/workspace', 'convert-to-nx-project', {
292
- all: true
292
+ all: true,
293
293
  });
294
294
  },
295
295
  ]);
package/migrations.json CHANGED
@@ -12,6 +12,47 @@
12
12
  }
13
13
  },
14
14
  "packageJsonUpdates": {
15
+ "11.0.21": {
16
+ "version": "11.0.21",
17
+ "packages": {
18
+ "@nstudio/angular": {
19
+ "version": "11.0.21",
20
+ "alwaysAddToPackageJson": false
21
+ },
22
+ "@nstudio/electron": {
23
+ "version": "11.0.21",
24
+ "alwaysAddToPackageJson": false
25
+ },
26
+ "@nstudio/electron-angular": {
27
+ "version": "11.0.21",
28
+ "alwaysAddToPackageJson": false
29
+ },
30
+ "@nstudio/ionic": {
31
+ "version": "11.0.21",
32
+ "alwaysAddToPackageJson": false
33
+ },
34
+ "@nstudio/ionic-angular": {
35
+ "version": "11.0.21",
36
+ "alwaysAddToPackageJson": false
37
+ },
38
+ "@nstudio/nativescript": {
39
+ "version": "11.0.21",
40
+ "alwaysAddToPackageJson": false
41
+ },
42
+ "@nstudio/nativescript-angular": {
43
+ "version": "11.0.21",
44
+ "alwaysAddToPackageJson": false
45
+ },
46
+ "@nstudio/web": {
47
+ "version": "11.0.21",
48
+ "alwaysAddToPackageJson": false
49
+ },
50
+ "@nstudio/web-angular": {
51
+ "version": "11.0.21",
52
+ "alwaysAddToPackageJson": false
53
+ }
54
+ }
55
+ },
15
56
  "12.4.3": {
16
57
  "version": "12.4.3",
17
58
  "packages": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nstudio/xplat",
3
- "version": "15.0.4-rc.0",
3
+ "version": "15.0.4-rc.1",
4
4
  "description": "Cross-platform (xplat) tools for Nx workspaces.",
5
5
  "homepage": "https://nstudio.io/xplat",
6
6
  "repository": {
@@ -41,8 +41,8 @@
41
41
  "postinstall": "node src/utils/postinstall.js"
42
42
  },
43
43
  "dependencies": {
44
- "@nstudio/focus": "15.0.4-rc.0",
45
- "@nstudio/xplat-utils": "15.0.4-rc.0"
44
+ "@nstudio/focus": "15.0.4-rc.1",
45
+ "@nstudio/xplat-utils": "15.0.4-rc.1"
46
46
  },
47
47
  "author": "Nathan Walker",
48
48
  "license": "MIT",
@@ -1,5 +1,77 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google Inc. All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT- style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Tree } from '@angular-devkit/schematics';
1
9
  import * as ts from 'typescript';
2
- import { Tree } from '@nrwl/devkit';
3
- import { Tree as NgTree } from '@angular-devkit/schematics';
4
- export declare function addGlobal(tree: Tree, source: ts.SourceFile, modulePath: string, statement: string, isExport?: boolean): ts.SourceFile[];
5
- export declare function insert(host: NgTree, modulePath: string, changes: any[]): void;
10
+ export declare function findNodes(node: ts.Node, kind: ts.SyntaxKind | ts.SyntaxKind[], max?: number): ts.Node[];
11
+ export declare function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[];
12
+ export interface Change {
13
+ apply(host: any): Promise<void>;
14
+ readonly type: string;
15
+ readonly path: string | null;
16
+ readonly order: number;
17
+ readonly description: string;
18
+ }
19
+ export declare class NoopChange implements Change {
20
+ type: string;
21
+ description: string;
22
+ order: number;
23
+ path: any;
24
+ apply(): Promise<void>;
25
+ }
26
+ export declare class InsertChange implements Change {
27
+ path: string;
28
+ pos: number;
29
+ toAdd: string;
30
+ type: string;
31
+ order: number;
32
+ description: string;
33
+ constructor(path: string, pos: number, toAdd: string);
34
+ apply(host: any): any;
35
+ }
36
+ export declare class RemoveChange implements Change {
37
+ path: string;
38
+ private pos;
39
+ private toRemove;
40
+ type: string;
41
+ order: number;
42
+ description: string;
43
+ constructor(path: string, pos: number, toRemove: string);
44
+ apply(host: any): Promise<void>;
45
+ }
46
+ export declare class ReplaceChange implements Change {
47
+ path: string;
48
+ pos: number;
49
+ oldText: string;
50
+ newText: string;
51
+ type: string;
52
+ order: number;
53
+ description: string;
54
+ constructor(path: string, pos: number, oldText: string, newText: string);
55
+ apply(host: any): Promise<void>;
56
+ }
57
+ export declare function addParameterToConstructor(source: ts.SourceFile, modulePath: string, opts: {
58
+ className: string;
59
+ param: string;
60
+ }): Change[];
61
+ export declare function addMethod(source: ts.SourceFile, modulePath: string, opts: {
62
+ className: string;
63
+ methodHeader: string;
64
+ body: string;
65
+ }): Change[];
66
+ export declare function findClass(source: ts.SourceFile, className: string, silent?: boolean): ts.ClassDeclaration;
67
+ export declare function offset(text: string, numberOfTabs: number, wrap: boolean): string;
68
+ export declare function addIncludeToTsConfig(tsConfigPath: string, source: ts.SourceFile, include: string): Change[];
69
+ export declare function getImport(source: ts.SourceFile, predicate: (a: any) => boolean): {
70
+ moduleSpec: string;
71
+ bindings: string[];
72
+ }[];
73
+ export declare function addGlobal(source: ts.SourceFile, modulePath: string, statement: string, isExport?: boolean): Change[];
74
+ export declare function insert(host: Tree, modulePath: string, changes: Change[]): void;
75
+ export declare function getProjectConfig(tree: Tree, name: string): any;
76
+ export declare function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string, fileName: string, isDefault?: boolean): Change;
77
+ export declare function replaceNodeValue(host: Tree, modulePath: string, node: ts.Node, content: string): void;
package/src/utils/ast.js CHANGED
@@ -1,33 +1,255 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.insert = exports.addGlobal = void 0;
4
- const js_1 = require("@nrwl/js");
5
- const typescript_1 = require("nx/src/utils/typescript");
3
+ exports.replaceNodeValue = exports.insertImport = exports.getProjectConfig = exports.insert = exports.addGlobal = exports.getImport = exports.addIncludeToTsConfig = exports.offset = exports.findClass = exports.addMethod = exports.addParameterToConstructor = exports.ReplaceChange = exports.RemoveChange = exports.InsertChange = exports.NoopChange = exports.getSourceNodes = exports.findNodes = void 0;
6
4
  const ts = require("typescript");
7
5
  const general_1 = require("./general");
8
- function addGlobal(tree, source, modulePath, statement, isExport) {
6
+ function nodesByPosition(first, second) {
7
+ return first.getStart() - second.getStart();
8
+ }
9
+ function insertAfterLastOccurrence(nodes, toInsert, file, fallbackPos, syntaxKind) {
10
+ // sort() has a side effect, so make a copy so that we won't overwrite the parent's object.
11
+ let lastItem = [...nodes].sort(nodesByPosition).pop();
12
+ if (!lastItem) {
13
+ throw new Error();
14
+ }
15
+ if (syntaxKind) {
16
+ lastItem = findNodes(lastItem, syntaxKind).sort(nodesByPosition).pop();
17
+ }
18
+ if (!lastItem && fallbackPos == undefined) {
19
+ throw new Error(`tried to insert ${toInsert} as first occurence with no fallback position`);
20
+ }
21
+ const lastItemPosition = lastItem ? lastItem.getEnd() : fallbackPos;
22
+ return new InsertChange(file, lastItemPosition, toInsert);
23
+ }
24
+ function findNodes(node, kind, max = Infinity) {
25
+ if (!node || max == 0) {
26
+ return [];
27
+ }
28
+ const arr = [];
29
+ const hasMatch = Array.isArray(kind)
30
+ ? kind.includes(node.kind)
31
+ : node.kind === kind;
32
+ if (hasMatch) {
33
+ arr.push(node);
34
+ max--;
35
+ }
36
+ if (max > 0) {
37
+ for (const child of node.getChildren()) {
38
+ findNodes(child, kind, max).forEach((node) => {
39
+ if (max > 0) {
40
+ arr.push(node);
41
+ }
42
+ max--;
43
+ });
44
+ if (max <= 0) {
45
+ break;
46
+ }
47
+ }
48
+ }
49
+ return arr;
50
+ }
51
+ exports.findNodes = findNodes;
52
+ function getSourceNodes(sourceFile) {
53
+ const nodes = [sourceFile];
54
+ const result = [];
55
+ while (nodes.length > 0) {
56
+ const node = nodes.shift();
57
+ if (node) {
58
+ result.push(node);
59
+ if (node.getChildCount(sourceFile) >= 0) {
60
+ nodes.unshift(...node.getChildren());
61
+ }
62
+ }
63
+ }
64
+ return result;
65
+ }
66
+ exports.getSourceNodes = getSourceNodes;
67
+ class NoopChange {
68
+ constructor() {
69
+ this.type = 'noop';
70
+ this.description = 'No operation.';
71
+ this.order = Infinity;
72
+ this.path = null;
73
+ }
74
+ apply() {
75
+ return Promise.resolve();
76
+ }
77
+ }
78
+ exports.NoopChange = NoopChange;
79
+ class InsertChange {
80
+ constructor(path, pos, toAdd) {
81
+ this.path = path;
82
+ this.pos = pos;
83
+ this.toAdd = toAdd;
84
+ this.type = 'insert';
85
+ if (pos < 0) {
86
+ throw new Error('Negative positions are invalid');
87
+ }
88
+ this.description = `Inserted ${toAdd} into position ${pos} of ${path}`;
89
+ this.order = pos;
90
+ }
91
+ apply(host) {
92
+ return host.read(this.path).then((content) => {
93
+ const prefix = content.substring(0, this.pos);
94
+ const suffix = content.substring(this.pos);
95
+ return host.write(this.path, `${prefix}${this.toAdd}${suffix}`);
96
+ });
97
+ }
98
+ }
99
+ exports.InsertChange = InsertChange;
100
+ class RemoveChange {
101
+ constructor(path, pos, toRemove) {
102
+ this.path = path;
103
+ this.pos = pos;
104
+ this.toRemove = toRemove;
105
+ this.type = 'remove';
106
+ if (pos < 0) {
107
+ throw new Error('Negative positions are invalid');
108
+ }
109
+ this.description = `Removed ${toRemove} into position ${pos} of ${path}`;
110
+ this.order = pos;
111
+ }
112
+ apply(host) {
113
+ return host.read(this.path).then((content) => {
114
+ const prefix = content.substring(0, this.pos);
115
+ const suffix = content.substring(this.pos + this.toRemove.length);
116
+ return host.write(this.path, `${prefix}${suffix}`);
117
+ });
118
+ }
119
+ }
120
+ exports.RemoveChange = RemoveChange;
121
+ class ReplaceChange {
122
+ constructor(path, pos, oldText, newText) {
123
+ this.path = path;
124
+ this.pos = pos;
125
+ this.oldText = oldText;
126
+ this.newText = newText;
127
+ this.type = 'replace';
128
+ if (pos < 0) {
129
+ throw new Error('Negative positions are invalid');
130
+ }
131
+ this.description = `Replaced ${oldText} into position ${pos} of ${path} with ${newText}`;
132
+ this.order = pos;
133
+ }
134
+ apply(host) {
135
+ return host.read(this.path).then((content) => {
136
+ const prefix = content.substring(0, this.pos);
137
+ const suffix = content.substring(this.pos + this.oldText.length);
138
+ const text = content.substring(this.pos, this.pos + this.oldText.length);
139
+ if (text !== this.oldText) {
140
+ return Promise.reject(new Error(`Invalid replace: "${text}" != "${this.oldText}".`));
141
+ }
142
+ return host.write(this.path, `${prefix}${this.newText}${suffix}`);
143
+ });
144
+ }
145
+ }
146
+ exports.ReplaceChange = ReplaceChange;
147
+ function addParameterToConstructor(source, modulePath, opts) {
148
+ const clazz = findClass(source, opts.className);
149
+ const constructor = clazz.members.filter((m) => m.kind === ts.SyntaxKind.Constructor)[0];
150
+ if (constructor) {
151
+ throw new Error('Should be tested');
152
+ }
153
+ else {
154
+ const methodHeader = `constructor(${opts.param})`;
155
+ return addMethod(source, modulePath, {
156
+ className: opts.className,
157
+ methodHeader,
158
+ body: null,
159
+ });
160
+ }
161
+ }
162
+ exports.addParameterToConstructor = addParameterToConstructor;
163
+ function addMethod(source, modulePath, opts) {
164
+ const clazz = findClass(source, opts.className);
165
+ const body = opts.body
166
+ ? `
167
+ ${opts.methodHeader} {
168
+ ${offset(opts.body, 1, false)}
169
+ }
170
+ `
171
+ : `
172
+ ${opts.methodHeader} {}
173
+ `;
174
+ return [new InsertChange(modulePath, clazz.end - 1, offset(body, 1, true))];
175
+ }
176
+ exports.addMethod = addMethod;
177
+ function findClass(source, className, silent = false) {
178
+ const nodes = getSourceNodes(source);
179
+ const clazz = (nodes.filter((n) => n.kind === ts.SyntaxKind.ClassDeclaration &&
180
+ n.name.text === className)[0]);
181
+ if (!clazz && !silent) {
182
+ throw new Error(`Cannot find class '${className}'`);
183
+ }
184
+ return clazz;
185
+ }
186
+ exports.findClass = findClass;
187
+ function offset(text, numberOfTabs, wrap) {
188
+ const lines = text
189
+ .trim()
190
+ .split('\n')
191
+ .map((line) => {
192
+ let tabs = '';
193
+ for (let c = 0; c < numberOfTabs; ++c) {
194
+ tabs += ' ';
195
+ }
196
+ return `${tabs}${line}`;
197
+ })
198
+ .join('\n');
199
+ return wrap ? `\n${lines}\n` : lines;
200
+ }
201
+ exports.offset = offset;
202
+ function addIncludeToTsConfig(tsConfigPath, source, include) {
203
+ const includeKeywordPos = source.text.indexOf('"include":');
204
+ if (includeKeywordPos > -1) {
205
+ const includeArrayEndPos = source.text.indexOf(']', includeKeywordPos);
206
+ return [new InsertChange(tsConfigPath, includeArrayEndPos, include)];
207
+ }
208
+ else {
209
+ return [];
210
+ }
211
+ }
212
+ exports.addIncludeToTsConfig = addIncludeToTsConfig;
213
+ function getImport(source, predicate) {
214
+ const allImports = findNodes(source, ts.SyntaxKind.ImportDeclaration);
215
+ const matching = allImports.filter((i) => predicate(i.moduleSpecifier.getText()));
216
+ return matching.map((i) => {
217
+ const moduleSpec = i.moduleSpecifier
218
+ .getText()
219
+ .substring(1, i.moduleSpecifier.getText().length - 1);
220
+ const t = i.importClause.namedBindings.getText();
221
+ const bindings = t
222
+ .replace('{', '')
223
+ .replace('}', '')
224
+ .split(',')
225
+ .map((q) => q.trim());
226
+ return { moduleSpec, bindings };
227
+ });
228
+ }
229
+ exports.getImport = getImport;
230
+ function addGlobal(source, modulePath, statement, isExport) {
9
231
  if (isExport) {
10
- const allExports = (0, typescript_1.findNodes)(source, ts.SyntaxKind.ExportDeclaration);
232
+ const allExports = findNodes(source, ts.SyntaxKind.ExportDeclaration);
11
233
  // console.log('allExports:', allExports.length);
12
234
  if (allExports.length > 0) {
13
235
  const lastExport = allExports[allExports.length - 1];
14
236
  // console.log('lastExport.end:', lastExport.end);
15
- return [(0, js_1.insertChange)(tree, source, modulePath, lastExport.end, `\n${statement}\n`)];
237
+ return [new InsertChange(modulePath, lastExport.end, `\n${statement}\n`)];
16
238
  }
17
239
  else {
18
- return [(0, js_1.insertChange)(tree, source, modulePath, 0, `${statement}\n`)];
240
+ return [new InsertChange(modulePath, 0, `${statement}\n`)];
19
241
  }
20
242
  }
21
243
  else {
22
- const allImports = (0, typescript_1.findNodes)(source, ts.SyntaxKind.ImportDeclaration);
244
+ const allImports = findNodes(source, ts.SyntaxKind.ImportDeclaration);
23
245
  if (allImports.length > 0) {
24
246
  const lastImport = allImports[allImports.length - 1];
25
247
  return [
26
- (0, js_1.insertChange)(tree, source, modulePath, lastImport.end + 1, `\n${statement}\n`),
248
+ new InsertChange(modulePath, lastImport.end + 1, `\n${statement}\n`),
27
249
  ];
28
250
  }
29
251
  else {
30
- return [(0, js_1.insertChange)(tree, source, modulePath, 0, `${statement}\n`)];
252
+ return [new InsertChange(modulePath, 0, `${statement}\n`)];
31
253
  }
32
254
  }
33
255
  }
@@ -40,22 +262,17 @@ function insert(host, modulePath, changes) {
40
262
  const orderedChanges = changes.sort((a, b) => b.order - a.order);
41
263
  const recorder = host.beginUpdate(modulePath);
42
264
  for (const change of orderedChanges) {
43
- // console.log('change.type:', change, ' -change.kind:', change.kind)
44
- let type = change.type;
45
- if (change.kind === 'c' || change.kind === 'o') {
46
- type = general_1.actionToFileChangeMap[change.kind];
47
- }
48
- if (type == 'insert') {
265
+ if (change.type == 'insert') {
49
266
  recorder.insertLeft(change.pos, change.toAdd);
50
267
  }
51
- else if (type == 'remove') {
268
+ else if (change.type == 'remove') {
52
269
  recorder.remove(change.pos - 1, change.toRemove.length + 1);
53
270
  }
54
- else if (type == 'replace') {
271
+ else if (change.type == 'replace') {
55
272
  recorder.remove(change.pos, change.oldText.length);
56
273
  recorder.insertLeft(change.pos, change.newText);
57
274
  }
58
- else if (type === 'noop') {
275
+ else if (change.type === 'noop') {
59
276
  // do nothing
60
277
  }
61
278
  else {
@@ -65,3 +282,71 @@ function insert(host, modulePath, changes) {
65
282
  host.commitUpdate(recorder);
66
283
  }
67
284
  exports.insert = insert;
285
+ function getProjectConfig(tree, name) {
286
+ const workspaceJson = (0, general_1.readWorkspaceJson)(tree);
287
+ const projectConfig = workspaceJson.projects[name];
288
+ if (!projectConfig) {
289
+ throw new Error(`Cannot find project '${name}'`);
290
+ }
291
+ else {
292
+ return projectConfig;
293
+ }
294
+ }
295
+ exports.getProjectConfig = getProjectConfig;
296
+ function insertImport(source, fileToEdit, symbolName, fileName, isDefault = false) {
297
+ const rootNode = source;
298
+ const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);
299
+ // get nodes that map to import statements from the file fileName
300
+ const relevantImports = allImports.filter((node) => {
301
+ // StringLiteral of the ImportDeclaration is the import file (fileName in this case).
302
+ const importFiles = node
303
+ .getChildren()
304
+ .filter((child) => child.kind === ts.SyntaxKind.StringLiteral)
305
+ .map((n) => n.text);
306
+ return importFiles.filter((file) => file === fileName).length === 1;
307
+ });
308
+ if (relevantImports.length > 0) {
309
+ let importsAsterisk = false;
310
+ // imports from import file
311
+ const imports = [];
312
+ relevantImports.forEach((n) => {
313
+ Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));
314
+ if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {
315
+ importsAsterisk = true;
316
+ }
317
+ });
318
+ // if imports * from fileName, don't add symbolName
319
+ if (importsAsterisk) {
320
+ return new NoopChange();
321
+ }
322
+ const importTextNodes = imports.filter((n) => n.text === symbolName);
323
+ // insert import if it's not there
324
+ if (importTextNodes.length === 0) {
325
+ const fallbackPos = findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||
326
+ findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();
327
+ return insertAfterLastOccurrence(imports, `, ${symbolName}`, fileToEdit, fallbackPos);
328
+ }
329
+ return new NoopChange();
330
+ }
331
+ // no such import declaration exists
332
+ const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral).filter((n) => n.text === 'use strict');
333
+ let fallbackPos = 0;
334
+ if (useStrict.length > 0) {
335
+ fallbackPos = useStrict[0].end;
336
+ }
337
+ const open = isDefault ? '' : '{ ';
338
+ const close = isDefault ? '' : ' }';
339
+ // if there are no imports or 'use strict' statement, insert import at beginning of file
340
+ const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;
341
+ const separator = insertAtBeginning ? '' : ';\n';
342
+ const toInsert = `${separator}import ${open}${symbolName}${close}` +
343
+ ` from '${fileName}'${insertAtBeginning ? ';\n' : ''}`;
344
+ return insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral);
345
+ }
346
+ exports.insertImport = insertImport;
347
+ function replaceNodeValue(host, modulePath, node, content) {
348
+ insert(host, modulePath, [
349
+ new ReplaceChange(modulePath, node.getStart(node.getSourceFile()), node.getFullText(), content),
350
+ ]);
351
+ }
352
+ exports.replaceNodeValue = replaceNodeValue;
@@ -282,7 +282,7 @@ class DevkitTreeFromAngularDevkitTree {
282
282
  }
283
283
  warnUnsupportedFilePermissionsChange(filePath, mode) {
284
284
  console.log(`The Angular DevKit tree does not support changing a file permissions.
285
- Ignoring changing ${filePath} permissions to ${mode}.`);
285
+ Ignoring changing ${filePath} permissions to ${mode}.`);
286
286
  }
287
287
  }
288
288
  exports.DevkitTreeFromAngularDevkitTree = DevkitTreeFromAngularDevkitTree;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nxVersion = exports.xplatVersion = void 0;
4
- exports.xplatVersion = '15.0.4-rc.0';
4
+ exports.xplatVersion = '15.0.4-rc.1';
5
5
  exports.nxVersion = '^15.0.0';
@@ -42,7 +42,8 @@ var XplatHelpers;
42
42
  */
43
43
  function addPackageWithNgAdd(packageName, options, callSchematicIfAdded) {
44
44
  return (host) => {
45
- const { dependencies, devDependencies } = (0, xplat_utils_1.getJsonFromFile)(host, 'package.json');
45
+ const json = (0, xplat_utils_1.getJsonFromFile)(host, 'package.json');
46
+ const { dependencies, devDependencies } = json;
46
47
  return dependencies[packageName] || devDependencies[packageName]
47
48
  ? callSchematicIfAdded
48
49
  ? (0, schematics_1.externalSchematic)(packageName, callSchematicIfAdded, options, {
@@ -768,25 +769,15 @@ var XplatFeatureHelpers;
768
769
  }
769
770
  XplatFeatureHelpers.addFiles = addFiles;
770
771
  function adjustBarrelIndex(options, indexFilePath) {
771
- return (tree, context) => {
772
- const devKitTree = (0, general_1.convertNgTreeToDevKit)(tree, context);
772
+ return (tree) => {
773
773
  // console.log('adjustBarrelIndex indexFilePath:', indexFilePath);
774
774
  // console.log('tree.exists(indexFilePath):', tree.exists(indexFilePath));
775
775
  const indexSource = tree.read(indexFilePath).toString('utf-8');
776
776
  const indexSourceFile = (0, typescript_1.createSourceFile)(indexFilePath, indexSource, typescript_1.ScriptTarget.Latest, true);
777
- // insert(tree, indexFilePath, [
778
- // ...addGlobal(
779
- // devKitTree,
780
- // indexSourceFile,
781
- // indexFilePath,
782
- // `export * from './${
783
- // options.directory ? options.directory + '/' : ''
784
- // }${options.name.toLowerCase()}';`,
785
- // true
786
- // ),
787
- // ]);
788
- (0, ast_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `export * from './${options.directory ? options.directory + '/' : ''}${options.name.toLowerCase()}';`, true);
789
- return devKitTree.tree;
777
+ (0, ast_1.insert)(tree, indexFilePath, [
778
+ ...(0, ast_1.addGlobal)(indexSourceFile, indexFilePath, `export * from './${options.directory ? options.directory + '/' : ''}${options.name.toLowerCase()}';`, true),
779
+ ]);
780
+ return tree;
790
781
  };
791
782
  }
792
783
  XplatFeatureHelpers.adjustBarrelIndex = adjustBarrelIndex;