@nativescript/webpack 3.1.0-hmr.0 → 4.1.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.
@@ -21,21 +21,26 @@ const parseWorkspaceConfig = function(platform, envConfigs, projectName, debug)
21
21
  if (workspaceConfig && projectName) {
22
22
  const projectSettings = workspaceConfig.projects[projectName];
23
23
  if (projectSettings) {
24
-
24
+ var targetProp = 'architect';
25
+ if (!projectSettings.architect) {
26
+ targetProp = 'targets'; // Nx
27
+ }
25
28
  // default project configurations
26
29
  for (const envConfig of envConfigs) {
27
- if (projectSettings.architect.default && projectSettings.architect.default.configurations) {
28
- const defaultConfigurations = projectSettings.architect.default.configurations;
29
- if (defaultConfigurations && defaultConfigurations[envConfig]) {
30
- if (defaultConfigurations[envConfig].fileReplacements) {
31
- for (const fileReplace of defaultConfigurations[envConfig].fileReplacements) {
32
- if (debug) {
33
- console.log('project fileReplacement:', fileReplace);
34
- }
35
- if (fileReplace.replace.indexOf('.ts') > -1) {
36
- fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`);
37
- } else {
38
- copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true });
30
+ if (projectSettings[targetProp]) {
31
+ if (projectSettings[targetProp].default && projectSettings[targetProp].default.configurations) {
32
+ const defaultConfigurations = projectSettings[targetProp].default.configurations;
33
+ if (defaultConfigurations && defaultConfigurations[envConfig]) {
34
+ if (defaultConfigurations[envConfig].fileReplacements) {
35
+ for (const fileReplace of defaultConfigurations[envConfig].fileReplacements) {
36
+ if (debug) {
37
+ console.log('project fileReplacement:', fileReplace);
38
+ }
39
+ if (fileReplace.replace.indexOf('.ts') > -1) {
40
+ fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`);
41
+ } else {
42
+ copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true });
43
+ }
39
44
  }
40
45
  }
41
46
  }
@@ -44,17 +49,19 @@ const parseWorkspaceConfig = function(platform, envConfigs, projectName, debug)
44
49
  }
45
50
  // platform specific configurations (always override top level project configurations)
46
51
  for (const envConfig of envConfigs) {
47
- if (projectSettings.architect && projectSettings.architect[platform]) {
48
- const platformConfig = projectSettings.architect[platform].configurations;
49
- if (platformConfig && platformConfig[envConfig] && platformConfig[envConfig].fileReplacements) {
50
- for (const fileReplace of platformConfig[envConfig].fileReplacements) {
51
- if (debug) {
52
- console.log(`"${platform}" specific fileReplacement:`, fileReplace);
53
- }
54
- if (fileReplace.replace.indexOf('.ts') > -1) {
55
- fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`);
56
- } else {
57
- copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true });
52
+ if (projectSettings[targetProp]) {
53
+ if (projectSettings[targetProp] && projectSettings[targetProp][platform]) {
54
+ const platformConfig = projectSettings[targetProp][platform].configurations;
55
+ if (platformConfig && platformConfig[envConfig] && platformConfig[envConfig].fileReplacements) {
56
+ for (const fileReplace of platformConfig[envConfig].fileReplacements) {
57
+ if (debug) {
58
+ console.log(`"${platform}" specific fileReplacement:`, fileReplace);
59
+ }
60
+ if (fileReplace.replace.indexOf('.ts') > -1) {
61
+ fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`);
62
+ } else {
63
+ copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true });
64
+ }
58
65
  }
59
66
  }
60
67
  }
package/host/resolver.js CHANGED
@@ -8,15 +8,6 @@ function getResolver(platforms, explicitResolve, nsPackageFilters, platformSpeci
8
8
  nsPackageFilters = nsPackageFilters || ['nativescript', 'tns', 'ns', '@nativescript'];
9
9
  platformSpecificExt = platformSpecificExt || ['.ts', '.js', '.scss', '.less', '.css', '.html', '.xml', '.vue', '.json'];
10
10
  return function (path) {
11
- const nmIndex = path.lastIndexOf('node_modules');
12
- if (nmIndex !== -1) {
13
- const subPath = path.substr(nmIndex + 'node_modules'.length).replace(/\\/g, '/');
14
- const shouldResolve = explicitResolve.length && explicitResolve.some((packageName) => subPath.indexOf(packageName) !== -1);
15
- const pathParts = subPath.split(/[/\-_]/);
16
- if (!shouldResolve && pathParts.every((p) => nsPackageFilters.every((f) => f !== p))) {
17
- return path;
18
- }
19
- }
20
11
  const { dir, name, ext } = path_1.parse(path);
21
12
  if (platformSpecificExt.indexOf(ext) === -1) {
22
13
  return path;
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.js","sourceRoot":"","sources":["resolver.ts"],"names":[],"mappings":";;;AAAA,+BAAmC;AACnC,2BAA8B;AAE9B,SAAgB,WAAW,CAAC,SAAmB,EAAE,eAA0B,EAAE,gBAA2B,EAAE,mBAA8B;IACvI,eAAe,GAAG,eAAe,IAAI,EAAE,CAAC;IACxC,gBAAgB,GAAG,gBAAgB,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;IACtF,mBAAmB,GAAG,mBAAmB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAExH,OAAO,UAAU,IAAY;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QAEjD,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE;YACnB,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,OAA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AE,EAAE;gBACZ,wCAAwC;aACxC;SACD;QAED,OAAO,IAAI,CAAC;IACb,CAAC,CAAC;AACH,CAAC;AA3BD,kCA2BC;AAED,kDAAkD;AAClD,SAAS,YAAY,CAAC,IAAY;IACjC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC1C,OAAO,IAAI,CAAC;KACZ;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/webpack",
3
- "version": "3.1.0-hmr.0",
3
+ "version": "4.1.0",
4
4
  "main": "index",
5
5
  "description": "Webpack plugin for NativeScript",
6
6
  "homepage": "https://nativescript.org",