@nstudio/xplat 15.0.3 → 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.
@@ -1,289 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateWorkspaceFileReplacements = exports.updateEnvsForNativeScript = exports.addEnvBase = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const workspace_1 = require("@nrwl/workspace");
6
- const xplat_utils_1 = require("@nstudio/xplat-utils");
7
- const path_1 = require("path");
8
- const fs = require("fs");
9
- function default_1() {
10
- return (0, schematics_1.chain)([
11
- (0, xplat_utils_1.prerun)({
12
- framework: 'angular',
13
- }, true),
14
- // add environment base setup to allow workspaces to start using
15
- addEnvBase(),
16
- // add envs to {N} apps
17
- updateEnvsForNativeScript(),
18
- // update workspace project fileReplacements to use new env locations
19
- updateWorkspaceFileReplacements(),
20
- ]);
21
- }
22
- exports.default = default_1;
23
- function addEnvBase() {
24
- return (tree, _context) => {
25
- const npmScope = (0, xplat_utils_1.getNpmScope)();
26
- const coreIndexPath = `/libs/xplat/core/src/lib/index.ts`;
27
- let coreIndex = tree.read(coreIndexPath).toString('utf-8');
28
- coreIndex = coreIndex.replace(`./environments/environment`, `./environments`);
29
- (0, workspace_1.createOrUpdate)(tree, coreIndexPath, coreIndex);
30
- const envInterfacePath = `/libs/xplat/core/src/lib/environments/environment.interface.ts`;
31
- const envInterface = `/**
32
- * Workspace shared environment properties
33
- */
34
- export interface IEnvironment {
35
- production?: boolean;
36
- }`;
37
- (0, workspace_1.createOrUpdate)(tree, envInterfacePath, envInterface);
38
- const envIndexPath = `/libs/xplat/core/src/lib/environments/index.ts`;
39
- const envIndex = `export * from './environment.interface';
40
- export * from './environment';`;
41
- (0, workspace_1.createOrUpdate)(tree, envIndexPath, envIndex);
42
- const envBasePath = `/libs/xplat/core/src/lib/environments/base/environment.base.ts`;
43
- const envBase = `import { IEnvironment } from '../environment.interface';
44
-
45
- /**
46
- * Reduce the most commonly used environment values here
47
- */
48
- export const environmentBase: IEnvironment = {
49
- production: false
50
- };`;
51
- (0, workspace_1.createOrUpdate)(tree, envBasePath, envBase);
52
- const envDevPath = `/libs/xplat/core/src/lib/environments/base/environment.dev.ts`;
53
- const envDev = `import { IEnvironment } from '@${npmScope}/xplat/core';
54
- import { deepMerge } from '@${npmScope}/xplat/utils';
55
- import { environmentBase } from './environment.base';
56
-
57
- export const environmentDev = deepMerge(environmentBase, <IEnvironment>{
58
- // customizations here...
59
- });
60
- `;
61
- (0, workspace_1.createOrUpdate)(tree, envDevPath, envDev);
62
- const envProdPath = `/libs/xplat/core/src/lib/environments/base/environment.prod.ts`;
63
- const envProd = `import { IEnvironment } from '@${npmScope}/xplat/core';
64
- import { deepMerge } from '@${npmScope}/xplat/utils';
65
- import { environmentBase } from './environment.base';
66
-
67
- export const environmentProd = deepMerge(environmentBase, <IEnvironment>{
68
- production: true,
69
- // customizations here...
70
- });
71
- `;
72
- (0, workspace_1.createOrUpdate)(tree, envProdPath, envProd);
73
- const envBaseIndexPath = `/libs/xplat/core/src/lib/environments/base/index.ts`;
74
- const envBaseIndex = `export * from './environment.base';
75
- export * from './environment.dev';
76
- export * from './environment.prod';
77
- `;
78
- (0, workspace_1.createOrUpdate)(tree, envBaseIndexPath, envBaseIndex);
79
- const utilsObjPath = `/libs/xplat/utils/src/lib/objects.ts`;
80
- let utilsObj = '';
81
- const utilsObjDeepMerge = `\n\nexport function deepMerge<T1, T2>(target: T1, source: T2): T1 & T2 {
82
- const result: any = {};
83
- Object.entries(target).forEach(([key, value]) => {
84
- if (key in source) {
85
- // potential overwrite
86
- if (typeof value !== typeof source[key]) {
87
- // value type mismatch, always take source values.
88
- result[key] = source[key];
89
- } else if (isObject(value)) {
90
- result[key] = deepMerge(value, source[key]);
91
- } else {
92
- result[key] = source[key];
93
- }
94
- } else {
95
- result[key] = value;
96
- }
97
- });
98
- Object.entries(source)
99
- .filter(([key]) => !(key in target))
100
- .forEach(([key, value]) => {
101
- result[key] = value;
102
- });
103
- return result;
104
- }`;
105
- if (tree.exists(utilsObjPath)) {
106
- utilsObj = tree.read(utilsObjPath).toString('utf-8');
107
- }
108
- if (utilsObj.indexOf('deepMerge') === -1) {
109
- utilsObj = utilsObj + utilsObjDeepMerge;
110
- }
111
- (0, workspace_1.createOrUpdate)(tree, utilsObjPath, utilsObj);
112
- };
113
- }
114
- exports.addEnvBase = addEnvBase;
115
- function updateEnvsForNativeScript() {
116
- return (tree, _context) => {
117
- const nativeScriptAppsPaths = (0, xplat_utils_1.getAppPaths)(tree, 'nativescript');
118
- const npmScope = (0, xplat_utils_1.getNpmScope)();
119
- // update {N} apps and configs
120
- for (const dirPath of nativeScriptAppsPaths) {
121
- // console.log(dir);
122
- // console.log('{N} appDir:', dirPath);
123
- const relativePath = dirPath
124
- .split('/')
125
- .filter((p) => !!p)
126
- .map((p) => '..')
127
- .join('/');
128
- // disable xplat env base handling to make it opt in when ready
129
- const cwd = process.cwd();
130
- const webpackConfigPath = (0, path_1.join)(cwd, 'node_modules/@nstudio/nativescript-angular/src/schematics/application/_files/webpack.config.js');
131
- // console.log('webpackConfigPath:', webpackConfigPath);
132
- let webpackConfig = fs.readFileSync(webpackConfigPath, {
133
- encoding: 'utf-8',
134
- });
135
- webpackConfig = webpackConfig.replace('if (isXplatWorkspace) {', `// opt in when ready to use in your workspace\n const xplatEnvBaseEnabled = false;\n if (xplatEnvBaseEnabled && isXplatWorkspace) {`);
136
- (0, workspace_1.createOrUpdate)(tree, `${dirPath}/webpack.config.js`, webpackConfig.replace('<%= pathOffset %>', relativePath));
137
- (0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/environments/environment.base.ts`, `import { IEnvironment } from '@${npmScope}/xplat/core';
138
- import { deepMerge } from '@${npmScope}/xplat/utils';
139
-
140
- export const environmentBase = function (baseWorkspaceEnv: IEnvironment, appEnvironmentCustom: IEnvironment = {}) {
141
- // base app environment + customizations
142
- const appEnvironment = deepMerge(
143
- <IEnvironment>{
144
- production: baseWorkspaceEnv.production,
145
- // shared app level customizations here...
146
- },
147
- appEnvironmentCustom
148
- );
149
- // base workspace environment + target app environment
150
- return deepMerge(baseWorkspaceEnv, appEnvironment);
151
- };
152
- `);
153
- (0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/environments/environment.dev.ts`, `import { environmentBase } from './environment.base';
154
- import { IEnvironment } from '@${npmScope}/xplat/core';
155
- import { environmentDev } from '@${npmScope}/xplat/environments';
156
-
157
- export const environment: IEnvironment = environmentBase(environmentDev, {
158
- // app level customizations here...
159
- });
160
- `);
161
- (0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/environments/environment.prod.ts`, `import { environmentBase } from './environment.base';
162
- import { IEnvironment } from '@${npmScope}/xplat/core';
163
- import { environmentProd } from '@${npmScope}/xplat/environments';
164
-
165
- export const environment: IEnvironment = environmentBase(environmentProd, {
166
- // app level customizations here...
167
- });
168
- `);
169
- }
170
- };
171
- }
172
- exports.updateEnvsForNativeScript = updateEnvsForNativeScript;
173
- function updateWorkspaceFileReplacements() {
174
- return (tree, _context) => {
175
- const workspacePath = (0, workspace_1.getWorkspacePath)(tree);
176
- const workspaceJson = (0, xplat_utils_1.getJsonFromFile)(tree, workspacePath);
177
- if (workspaceJson && workspaceJson.projects) {
178
- const projectNames = Object.keys(workspaceJson.projects);
179
- for (const name of projectNames) {
180
- let targetProp = 'architect';
181
- if (workspaceJson.projects[name] &&
182
- !workspaceJson.projects[name].architect) {
183
- targetProp = 'targets';
184
- }
185
- if (workspaceJson.projects[name] &&
186
- workspaceJson.projects[name][targetProp]) {
187
- if (workspaceJson.projects[name][targetProp].build) {
188
- // update style references
189
- if (workspaceJson.projects[name][targetProp].build.options &&
190
- workspaceJson.projects[name][targetProp].build.options.styles) {
191
- for (let i = 0; i <
192
- workspaceJson.projects[name][targetProp].build.options.styles
193
- .length; i++) {
194
- const styleEntry = workspaceJson.projects[name][targetProp].build.options.styles[i];
195
- if (typeof styleEntry === 'string' &&
196
- styleEntry.indexOf('xplat/web/scss') > -1 &&
197
- styleEntry.indexOf('libs/xplat/web') === -1) {
198
- workspaceJson.projects[name][targetProp].build.options.styles[i] = styleEntry.replace('xplat/web/scss', 'libs/xplat/web/scss/src');
199
- }
200
- else if (styleEntry && typeof styleEntry === 'object') {
201
- if (styleEntry.input &&
202
- typeof styleEntry.input === 'string' &&
203
- styleEntry.input.indexOf('xplat/web/scss') > -1 &&
204
- styleEntry.input.indexOf('libs/xplat/web') === -1) {
205
- workspaceJson.projects[name][targetProp].build.options.styles[i].input = styleEntry.input.replace('xplat/web/scss', 'libs/xplat/web/scss/src');
206
- }
207
- }
208
- }
209
- }
210
- // update configuration fileReplacements
211
- if (workspaceJson.projects[name][targetProp].build.configurations) {
212
- const configKeys = Object.keys(workspaceJson.projects[name][targetProp].build.configurations);
213
- for (const configKey of configKeys) {
214
- if (workspaceJson.projects[name][targetProp].build.configurations[configKey].fileReplacements) {
215
- let updatedFileReplace;
216
- for (let i = 0; i <
217
- workspaceJson.projects[name][targetProp].build
218
- .configurations[configKey].fileReplacements.length; i++) {
219
- const replaceOption = workspaceJson.projects[name][targetProp].build
220
- .configurations[configKey].fileReplacements[i];
221
- if (replaceOption.replace &&
222
- replaceOption.replace.indexOf('libs/core') > -1) {
223
- if (!updatedFileReplace) {
224
- updatedFileReplace = replaceOption;
225
- }
226
- updatedFileReplace.replace =
227
- updatedFileReplace.replace.replace('libs/core', 'libs/xplat/core/src/lib');
228
- }
229
- if (replaceOption.with &&
230
- replaceOption.with.indexOf('libs/core') > -1) {
231
- if (!updatedFileReplace) {
232
- updatedFileReplace = replaceOption;
233
- }
234
- updatedFileReplace.with = updatedFileReplace.with.replace('libs/core', 'libs/xplat/core/src/lib');
235
- }
236
- if (updatedFileReplace) {
237
- workspaceJson.projects[name][targetProp].build.configurations[configKey].fileReplacements[i] =
238
- updatedFileReplace;
239
- }
240
- }
241
- }
242
- }
243
- }
244
- }
245
- // {N}: update configuration fileReplacements
246
- if (workspaceJson.projects[name][targetProp].default &&
247
- workspaceJson.projects[name][targetProp].default.configurations) {
248
- const configKeys = Object.keys(workspaceJson.projects[name][targetProp].default.configurations);
249
- for (const configKey of configKeys) {
250
- if (workspaceJson.projects[name][targetProp].default.configurations[configKey].fileReplacements) {
251
- let updatedFileReplace;
252
- for (let i = 0; i <
253
- workspaceJson.projects[name][targetProp].default
254
- .configurations[configKey].fileReplacements.length; i++) {
255
- const replaceOption = workspaceJson.projects[name][targetProp].default
256
- .configurations[configKey].fileReplacements[i];
257
- if (replaceOption.replace &&
258
- replaceOption.replace.indexOf('libs/core') > -1) {
259
- if (!updatedFileReplace) {
260
- updatedFileReplace = replaceOption;
261
- }
262
- updatedFileReplace.replace =
263
- updatedFileReplace.replace.replace('libs/core', 'libs/xplat/core/src/lib');
264
- }
265
- if (replaceOption.with &&
266
- replaceOption.with.indexOf('libs/core') > -1) {
267
- if (!updatedFileReplace) {
268
- updatedFileReplace = replaceOption;
269
- }
270
- updatedFileReplace.with = updatedFileReplace.with.replace('libs/core', 'libs/xplat/core/src/lib');
271
- }
272
- if (updatedFileReplace) {
273
- workspaceJson.projects[name][targetProp].default.configurations[configKey].fileReplacements[i] =
274
- updatedFileReplace;
275
- }
276
- }
277
- }
278
- }
279
- }
280
- }
281
- }
282
- return (0, xplat_utils_1.updateJsonFile)(tree, workspacePath, workspaceJson);
283
- }
284
- else {
285
- return (0, schematics_1.noop)();
286
- }
287
- };
288
- }
289
- exports.updateWorkspaceFileReplacements = updateWorkspaceFileReplacements;
@@ -1,6 +0,0 @@
1
- import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
2
- export interface PackageNameMapping {
3
- [packageName: string]: string;
4
- }
5
- export default function (): Rule;
6
- export declare function updateImports(): (tree: Tree, _context: SchematicContext) => import("@angular-devkit/schematics/src/tree/interface").Tree;
@@ -1,173 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateImports = void 0;
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const xplat_utils_1 = require("@nstudio/xplat-utils");
6
- const xplat_1 = require("@nstudio/xplat");
7
- // import xplatAngular from '@nstudio/angular/src/schematics/xplat/index';
8
- const ts = require("typescript");
9
- const options = {};
10
- const importsToUpdateMapping = {};
11
- const importsScssToUpdateMapping = {};
12
- function default_1() {
13
- return (0, schematics_1.chain)([
14
- (0, xplat_utils_1.prerun)({
15
- framework: 'angular',
16
- }, true),
17
- // update imports throughout old lib architecture and apps
18
- updateImports(),
19
- ]);
20
- }
21
- exports.default = default_1;
22
- function updateImports() {
23
- return (tree, _context) => {
24
- const npmScope = (0, xplat_utils_1.getNpmScope)();
25
- importsToUpdateMapping[`@${npmScope}/core`] = `@${npmScope}/xplat/core`;
26
- importsToUpdateMapping[`@${npmScope}/core/*`] = `@${npmScope}/xplat/core`;
27
- importsToUpdateMapping[`@${npmScope}/features`] = `@${npmScope}/xplat/features`;
28
- importsToUpdateMapping[`@${npmScope}/features/*`] = `@${npmScope}/xplat/features`;
29
- importsToUpdateMapping[`@${npmScope}/utils`] = `@${npmScope}/xplat/utils`;
30
- importsToUpdateMapping[`@${npmScope}/utils/*`] = `@${npmScope}/xplat/utils`;
31
- // collect which platforms were currently used
32
- importsToUpdateMapping[`@${npmScope}/electron`] = `@${npmScope}/xplat/electron/core`;
33
- importsToUpdateMapping[`@${npmScope}/electron/core`] = `@${npmScope}/xplat/electron/core`;
34
- importsToUpdateMapping[`@${npmScope}/electron/core/*`] = `@${npmScope}/xplat/electron/core`;
35
- importsToUpdateMapping[`@${npmScope}/electron/features`] = `@${npmScope}/xplat/electron/features`;
36
- importsToUpdateMapping[`@${npmScope}/electron/features/*`] = `@${npmScope}/xplat/electron/features`;
37
- importsToUpdateMapping[`@${npmScope}/electron/utils`] = `@${npmScope}/xplat/electron/utils`;
38
- importsToUpdateMapping[`@${npmScope}/electron/utils/*`] = `@${npmScope}/xplat/electron/utils`;
39
- importsToUpdateMapping[`@${npmScope}/ionic`] = `@${npmScope}/xplat/ionic/core`;
40
- importsToUpdateMapping[`@${npmScope}/ionic/core`] = `@${npmScope}/xplat/ionic/core`;
41
- importsToUpdateMapping[`@${npmScope}/ionic/core/*`] = `@${npmScope}/xplat/ionic/core`;
42
- importsToUpdateMapping[`@${npmScope}/ionic/features`] = `@${npmScope}/xplat/ionic/features`;
43
- importsToUpdateMapping[`@${npmScope}/ionic/features/*`] = `@${npmScope}/xplat/ionic/features`;
44
- importsToUpdateMapping[`@${npmScope}/ionic/utils`] = `@${npmScope}/xplat/ionic/utils`;
45
- importsToUpdateMapping[`@${npmScope}/ionic/utils/*`] = `@${npmScope}/xplat/ionic/utils`;
46
- importsToUpdateMapping[`@${npmScope}/nativescript`] = `@${npmScope}/xplat/nativescript/core`;
47
- importsToUpdateMapping[`@${npmScope}/nativescript/core`] = `@${npmScope}/xplat/nativescript/core`;
48
- importsToUpdateMapping[`@${npmScope}/nativescript/core/*`] = `@${npmScope}/xplat/nativescript/core`;
49
- importsToUpdateMapping[`@${npmScope}/nativescript/features`] = `@${npmScope}/xplat/nativescript/features`;
50
- importsToUpdateMapping[`@${npmScope}/nativescript/features/*`] = `@${npmScope}/xplat/nativescript/features`;
51
- importsToUpdateMapping[`@${npmScope}/nativescript/utils`] = `@${npmScope}/xplat/nativescript/utils`;
52
- importsToUpdateMapping[`@${npmScope}/nativescript/utils/*`] = `@${npmScope}/xplat/nativescript/utils`;
53
- importsToUpdateMapping[`@${npmScope}/web`] = `@${npmScope}/xplat/web/core`;
54
- importsToUpdateMapping[`@${npmScope}/web/core`] = `@${npmScope}/xplat/web/core`;
55
- importsToUpdateMapping[`@${npmScope}/web/core/*`] = `@${npmScope}/xplat/web/core`;
56
- importsToUpdateMapping[`@${npmScope}/web/features`] = `@${npmScope}/xplat/web/features`;
57
- importsToUpdateMapping[`@${npmScope}/web/features/*`] = `@${npmScope}/xplat/web/features`;
58
- importsToUpdateMapping[`@${npmScope}/web/utils`] = `@${npmScope}/xplat/web/utils`;
59
- importsToUpdateMapping[`@${npmScope}/web/utils/*`] = `@${npmScope}/xplat/web/utils`;
60
- // console.log(
61
- // 'updateImports',
62
- // 'directoriesToUpdateImports:',
63
- // directoriesToUpdateImports
64
- // );
65
- // scss imports
66
- importsScssToUpdateMapping[`@${npmScope}/scss`] = `@${npmScope}/xplat-scss`;
67
- importsScssToUpdateMapping[`@${npmScope}/ionic-scss`] = `@${npmScope}/xplat-ionic-scss`;
68
- importsScssToUpdateMapping[`@${npmScope}/web-scss`] = `@${npmScope}/xplat-web-scss`;
69
- importsScssToUpdateMapping[`@${npmScope}/nativescript-scss`] = `@${npmScope}/xplat-nativescript-scss`;
70
- ['/libs', '/apps']
71
- .map((dir) => tree.getDir(dir))
72
- .forEach((projectDir) => {
73
- projectDir.visit((file) => {
74
- // only look at .ts and .scss files
75
- // ignore some directories in various apps
76
- if (!/^.*\.(ts|scss)$/.test(file) ||
77
- file.indexOf('/node_modules/') > -1 ||
78
- file.indexOf('/platforms/ios') > -1 ||
79
- file.indexOf('/platforms/android') > -1) {
80
- return;
81
- }
82
- // if it doesn't contain at least 1 reference to the packages to be renamed bail out
83
- const contents = tree.read(file).toString('utf-8');
84
- if (/^.*\.scss$/.test(file)) {
85
- if (!Object.keys(importsScssToUpdateMapping).some((packageName) => contents.includes(packageName))) {
86
- return;
87
- }
88
- Object.entries(importsScssToUpdateMapping).forEach(([packageName, newPackageName]) => {
89
- if (contents.indexOf(packageName) > -1) {
90
- const regEx = new RegExp(packageName, 'ig');
91
- tree.overwrite(file, contents.replace(regEx, newPackageName));
92
- }
93
- });
94
- }
95
- else {
96
- if (!Object.keys(importsToUpdateMapping).some((packageName) => contents.includes(packageName))) {
97
- return;
98
- }
99
- // console.log('updateImports', 'found old import in:', file);
100
- const astSource = ts.createSourceFile(file, contents, ts.ScriptTarget.Latest, true);
101
- const changes = Object.entries(importsToUpdateMapping)
102
- .map(([packageName, newPackageName]) => {
103
- if (file.indexOf('apps/') > -1) {
104
- // ensure core vs. shared is handled
105
- if (file.indexOf('core.module') > -1 ||
106
- file.indexOf('app.module') > -1) {
107
- if (packageName.indexOf(`@${npmScope}/core`) > -1) {
108
- newPackageName = `@${npmScope}/xplat/core`;
109
- }
110
- else if (file.indexOf(`@${npmScope}/features`) > -1) {
111
- newPackageName = `@${npmScope}/xplat/features`;
112
- }
113
- else if (file.indexOf('electron') > -1) {
114
- newPackageName = `@${npmScope}/xplat/electron/core`;
115
- }
116
- else if (file.indexOf('ionic') > -1) {
117
- newPackageName = `@${npmScope}/xplat/ionic/core`;
118
- }
119
- else if (file.indexOf('nativescript') > -1) {
120
- newPackageName = `@${npmScope}/xplat/nativescript/core`;
121
- }
122
- else if (file.indexOf('web') > -1) {
123
- newPackageName = `@${npmScope}/xplat/web/core`;
124
- }
125
- }
126
- else if (file.indexOf('.module') > -1) {
127
- if (file.indexOf('electron') > -1) {
128
- newPackageName = `@${npmScope}/xplat/electron/features`;
129
- }
130
- else if (file.indexOf('ionic') > -1) {
131
- newPackageName = `@${npmScope}/xplat/ionic/features`;
132
- }
133
- else if (file.indexOf('nativescript') > -1) {
134
- newPackageName = `@${npmScope}/xplat/nativescript/features`;
135
- }
136
- else if (file.indexOf('web') > -1) {
137
- newPackageName = `@${npmScope}/xplat/web/features`;
138
- }
139
- }
140
- }
141
- const nodes = (0, xplat_1.findNodes)(astSource, ts.SyntaxKind.ImportDeclaration);
142
- return nodes
143
- .filter((node) => {
144
- // remove quotes from module name
145
- const rawImportModuleText = node.moduleSpecifier
146
- .getText()
147
- .slice(1)
148
- .slice(0, -1);
149
- if (packageName.indexOf('*') > -1) {
150
- // replace deep imports
151
- return (rawImportModuleText.indexOf(packageName.replace('*', '')) === 0);
152
- }
153
- else {
154
- // replace exact matches
155
- return rawImportModuleText === packageName;
156
- }
157
- })
158
- .map((node) => new xplat_1.ReplaceChange(file, node.moduleSpecifier.getStart(), node.moduleSpecifier.getText(), `'${newPackageName}'`));
159
- })
160
- // .flatMap()/.flat() is not available? So, here's a flat poly
161
- .reduce((acc, val) => acc.concat(val), []);
162
- // if the reference to packageName was in fact an import statement
163
- if (changes.length > 0) {
164
- // update the file in the tree
165
- (0, xplat_1.insert)(tree, file, changes);
166
- }
167
- }
168
- });
169
- });
170
- return tree;
171
- };
172
- }
173
- exports.updateImports = updateImports;