Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 3b120da

Browse files
Merge pull request #986 from NativeScript/vladimirov/merge-rel-master
chore: merge release in master
2 parents ef7f952 + 0585a91 commit 3b120da

33 files changed

+292
-390
lines changed

Diff for: .gitignore

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@
22
node_modules
33
*.tgz
44
package-lock.json
5+
*.js.map
56

67
plugins/NativeScriptAngularCompilerPlugin.d.ts
78
plugins/NativeScriptAngularCompilerPlugin.js
8-
plugins/NativeScriptAngularCompilerPlugin.js.map
99

1010
transformers/*.d.ts
1111
transformers/*.js
12-
transformers/*.js.map
1312

1413
utils/*.d.ts
1514
utils/*.js
16-
utils/*.js.map
15+
16+
hmr/*.d.ts
17+
hmr/*.js
1718

1819
plugins/PlatformFSPlugin.d.ts
1920
plugins/PlatformFSPlugin.js
20-
plugins/PlatformFSPlugin.js.map
2121

2222
plugins/WatchStateLoggerPlugin.d.ts
2323
plugins/WatchStateLoggerPlugin.js
24-
plugins/WatchStateLoggerPlugin.js.map
2524

2625
host/resolver.d.ts
2726
host/resolver.js
28-
host/resolver.js.map
2927

3028
jasmine-config/reporter.d.ts
3129
jasmine-config/reporter.js
32-
jasmine-config/reporter.js.map
30+
31+
bundle-config-loader.d.ts
32+
bundle-config-loader.js
3333

3434
**/*.spec.js*
3535
**/*.spec.d.ts*

Diff for: .vscode/launch.json

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@
1919
"args": [ "--env.android", "--env.aot" ],
2020
"runtimeArgs": [ "--preserve-symlinks" ],
2121
"stopOnEntry": true,
22+
},
23+
{
24+
"type": "node",
25+
"request": "launch",
26+
"name": "TypeScriptApp Webpack",
27+
"cwd": "${workspaceFolder}/demo/TypeScriptApp",
28+
"program": "${workspaceFolder}/demo/TypeScriptApp/node_modules/.bin/webpack",
29+
"args": [ "--env.android" ],
30+
"stopOnEntry": true,
31+
"preLaunchTask": "npm:tsc"
2232
}
2333
]
2434
}

Diff for: .vscode/tasks.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label":"npm:tsc",
8+
"type": "npm",
9+
"script": "tsc",
10+
"problemMatcher": []
11+
}
12+
]
13+
}

Diff for: CHANGELOG.md

+40
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
<a name="1.0.0"></a>
2+
# [1.0.0](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.24.1...1.0.0) (2019-07-10)
3+
4+
5+
### Bug Fixes
6+
7+
* allow overriding the `global.process` object from both the app and the plugins ([8c4292e](https://github.com/NativeScript/nativescript-dev-webpack/commit/8c4292e))
8+
* auto accept new or deleted files ([#972](https://github.com/NativeScript/nativescript-dev-webpack/issues/972)) ([bd893ce](https://github.com/NativeScript/nativescript-dev-webpack/commit/bd893ce))
9+
* avoid generating invalid JavaScript when merging IIFE files ([7586d4c](https://github.com/NativeScript/nativescript-dev-webpack/commit/7586d4c))
10+
* create PropertyAssignment instead of string literal (Identifier) when modifying the NgModule - in some cases (e.g. when there is a decomposition in another NgModule property), the TypeScipt program is trying to read `node.name.kind` on each property causing an exception for Identifiers) ([a70fb3b](https://github.com/NativeScript/nativescript-dev-webpack/commit/a70fb3b))
11+
* do not add inspector_modules entry when core modules are an external module ([e0cd8c1](https://github.com/NativeScript/nativescript-dev-webpack/commit/e0cd8c1))
12+
* do not show warning for format differences in templates ([#947](https://github.com/NativeScript/nativescript-dev-webpack/issues/947)) ([a352064](https://github.com/NativeScript/nativescript-dev-webpack/commit/a352064))
13+
* don't restart application when lazy loaded code is changed in angular app with uglify option ([121c3b2](https://github.com/NativeScript/nativescript-dev-webpack/commit/121c3b2))
14+
* emit inspector_modules as a module ([be2a5a6](https://github.com/NativeScript/nativescript-dev-webpack/commit/be2a5a6))
15+
* fix app.css file path on windows machines ([7d734d8](https://github.com/NativeScript/nativescript-dev-webpack/commit/7d734d8))
16+
* fix hmr for platform specific files in linked plugins ([#946](https://github.com/NativeScript/nativescript-dev-webpack/issues/946)) ([9e8c921](https://github.com/NativeScript/nativescript-dev-webpack/commit/9e8c921))
17+
* follow the symlinks in JavaScript apps ([#941](https://github.com/NativeScript/nativescript-dev-webpack/issues/941)) ([f0c62fb](https://github.com/NativeScript/nativescript-dev-webpack/commit/f0c62fb))
18+
* hmr should work with uglify ([#953](https://github.com/NativeScript/nativescript-dev-webpack/issues/953)) ([874e4f8](https://github.com/NativeScript/nativescript-dev-webpack/commit/874e4f8))
19+
* **xml-ns-loader:** remove wrong register of xml ([#940](https://github.com/NativeScript/nativescript-dev-webpack/issues/940)) ([bc2f6f1](https://github.com/NativeScript/nativescript-dev-webpack/commit/bc2f6f1))
20+
* inject app.css file from unit-test-runner on test command ([#949](https://github.com/NativeScript/nativescript-dev-webpack/issues/949)) ([a216ed3](https://github.com/NativeScript/nativescript-dev-webpack/commit/a216ed3))
21+
* log the real snapshot tool error by trying to evaluate the input file script ([1a9c4b2](https://github.com/NativeScript/nativescript-dev-webpack/commit/1a9c4b2))
22+
* migrate demo apps to android x ([c2d6684](https://github.com/NativeScript/nativescript-dev-webpack/commit/c2d6684))
23+
* unify the entry points handling and enable custom applications in android ([de10041](https://github.com/NativeScript/nativescript-dev-webpack/commit/de10041))
24+
* **hooks:** improve hooks handling ([#961](https://github.com/NativeScript/nativescript-dev-webpack/issues/961)) ([f558607](https://github.com/NativeScript/nativescript-dev-webpack/commit/f558607))
25+
26+
### Features
27+
28+
* introduce webpack only workflow ([#882](https://github.com/NativeScript/nativescript-dev-webpack/issues/882)) ([2de4c68](https://github.com/NativeScript/nativescript-dev-webpack/commit/2de4c68))
29+
* no need of "page" suffix ([#966](https://github.com/NativeScript/nativescript-dev-webpack/pull/966)) ([d4a8dec](https://github.com/NativeScript/nativescript-dev-webpack/commit/d4a8dec803acf39b7cdeb4f3bc8c23284046fe67))
30+
* support for file qualifiers ([#966](https://github.com/NativeScript/nativescript-dev-webpack/pull/966)) ([d4a8dec](https://github.com/NativeScript/nativescript-dev-webpack/commit/d4a8dec803acf39b7cdeb4f3bc8c23284046fe67))
31+
* universal hmr loader ([#966](https://github.com/NativeScript/nativescript-dev-webpack/pull/966)) ([d4a8dec](https://github.com/NativeScript/nativescript-dev-webpack/commit/d4a8dec803acf39b7cdeb4f3bc8c23284046fe67))
32+
33+
### BREAKING CHANGES:
34+
35+
* the file names of the NativeScript pages are not required to end with `-page` or `-root`. All `xml`, `css`, `js`, `ts` and `scss` files are not included in the bundle.
36+
37+
* the plugin is not working with NativeScript CLI older than 6.0.0 (`[email protected]`).
38+
39+
* the Webpack mode it set to `production` based on the `--release` flag of the NativeScript CLI, instead of the `--env.uglify` one.
40+
141
<a name="0.24.1"></a>
242
## [0.24.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.24.0...0.24.1) (2019-06-06)
343

Diff for: bundle-config-loader.js renamed to bundle-config-loader.ts

+33-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
1-
const unitTestingConfigLoader = require("./unit-testing-config-loader");
1+
import * as unitTestingConfigLoader from "./unit-testing-config-loader";
2+
import { loader } from "webpack";
3+
import { getOptions } from "loader-utils";
4+
import * as escapeRegExp from "escape-string-regexp";
25

3-
module.exports = function (source, map) {
4-
this.cacheable();
5-
const { angular = false, loadCss = true, unitTesting, projectRoot, appFullPath, registerModules = /(root|page)\.(xml|css|js|ts|scss)$/ } = this.query;
6+
// Matches all source, markup and style files that are not in App_Resources
7+
const defaultMatch = "(?<!App_Resources.*)\.(xml|css|js|(?<!d\.)ts|scss)$";
8+
9+
const loader: loader.Loader = function (source, map) {
10+
let {
11+
angular = false,
12+
loadCss = true,
13+
unitTesting,
14+
projectRoot,
15+
appFullPath,
16+
registerModules,
17+
ignoredFiles = []
18+
} = getOptions(this);
19+
20+
if (!registerModules) {
21+
registerModules = defaultMatch;
22+
for (const key in ignoredFiles) {
23+
registerModules = `(?<!${escapeRegExp(ignoredFiles[key])})` + registerModules;
24+
}
25+
registerModules = new RegExp(registerModules);
26+
}
627

728
if (unitTesting) {
829
source = unitTestingConfigLoader({ appFullPath, projectRoot, angular, rootPagesRegExp: registerModules });
@@ -51,6 +72,11 @@ module.exports = function (source, map) {
5172
${hmr}
5273
const context = require.context("~/", true, ${registerModules});
5374
global.registerWebpackModules(context);
75+
if (module.hot) {
76+
module.hot.accept(context.id, () => {
77+
console.log("HMR: Accept module '" + context.id + "' from '" + module.id + "'");
78+
});
79+
}
5480
${source}
5581
`;
5682
}
@@ -68,3 +94,6 @@ module.exports = function (source, map) {
6894

6995
this.callback(null, source, map);
7096
};
97+
98+
99+
export default loader;

Diff for: demo/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ tsconfig.aot.json
1616
vendor.js
1717
vendor.ts
1818

19-
tsconfig.esm.json
19+
tsconfig.esm.json
20+
mochawesome-report

Diff for: demo/AngularApp/.vscode/launch.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,8 @@
1616
"999999",
1717
"--colors",
1818
"--opts",
19-
"./e2e/config/mocha.opts",
20-
"--runType",
21-
"android23",
22-
"--reuseDevice"
23-
// "${workspaceFolder}/test"
19+
"../config/mocha.opts",
20+
"android"
2421
],
2522
"internalConsoleOptions": "openOnSessionStart"
2623
},

Diff for: demo/AngularApp/e2e/tests.e2e-spec.ts

+5-20
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,14 @@
1-
import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium";
1+
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
22
import { assert } from "chai";
33

44
describe("sample scenario", async function () {
55
let driver: AppiumDriver;
66

77
before(async function () {
8+
nsCapabilities.testReporter.context = this;
89
driver = await createDriver();
910
});
1011

11-
beforeEach(async function () {
12-
try {
13-
const items = await getItems();
14-
} catch (err) {
15-
try {
16-
const lblNinjas = await driver.findElementByText("Ninjas!");
17-
}
18-
catch (err) {
19-
console.log("Navigating to ninjas page ...");
20-
await driver.navBack();
21-
}
22-
console.log("Navigating to main page ...");
23-
await driver.navBack();
24-
}
25-
});
26-
2712
afterEach(async function () {
2813
if (this.currentTest.state === "failed") {
2914
await driver.logTestArtifacts(this.currentTest.title);
@@ -36,7 +21,7 @@ describe("sample scenario", async function () {
3621
});
3722

3823
it("should navigate to a ninja", async function () {
39-
const btnNinjas = await driver.findElementByText("Ninjas");
24+
const btnNinjas = await driver.waitForElement("Ninjas");
4025
await btnNinjas.click();
4126

4227
const itemMichaelangelo = await driver.findElementByText("Michaelangelo");
@@ -61,10 +46,10 @@ describe("sample scenario", async function () {
6146
for (let styleType in styleTypes) {
6247
it(`should find an element with ${styleType} style applied`, async function () {
6348
const element = await driver.findElementByText(styleTypes[styleType]);
49+
driver.imageHelper.options.keepOriginalImageSize = false;
50+
driver.imageHelper.options.isDeviceSpecific = false;
6451
const result = await driver.compareElement(element, "style");
6552
assert.isTrue(result);
6653
});
6754
}
68-
69-
const getItems = async function () { return driver.isAndroid ? await driver.findElementsByText("(Android)") : await driver.findElementsByText("(ios)"); }
7055
});

Diff for: demo/AngularApp/e2e/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"experimentalDecorators": true,
66
"emitDecoratorMetadata": true,
77
"importHelpers": false,
8+
"sourceMap": true,
89
"types": [
910
"mocha",
1011
"chai",

Diff for: demo/AngularApp/webpack.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module.exports = env => {
3333

3434
// Default destination inside platforms/<platform>/...
3535
const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
36-
const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS";
3736

3837
const {
3938
// The 'appPath' and 'appResourcesPath' values are fetched from
@@ -110,6 +109,7 @@ module.exports = env => {
110109
itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`);
111110
}
112111

112+
nsWebpack.processAppComponents(appComponents, platform);
113113
const config = {
114114
mode: production ? "production" : "development",
115115
context: appFullPath,
@@ -214,6 +214,7 @@ module.exports = env => {
214214
unitTesting,
215215
appFullPath,
216216
projectRoot,
217+
ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform)
217218
}
218219
},
219220
].filter(loader => !!loader)

0 commit comments

Comments
 (0)