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

chore: merge release in master #986

Merged
merged 29 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dbf6bdc
Update webpack-bundle-analyzer to patch 3.3.2
mudlabs May 23, 2019
76314ee
Update package.json
mudlabs Jun 5, 2019
4e622ae
Merge branch 'master' into dependencies
mudlabs Jun 6, 2019
790e386
Merge branch 'master' into dependencies
mudlabs Jun 16, 2019
121c3b2
fix: don't restart application when lazy loaded code is changed in an…
Fatme Jun 30, 2019
a70fb3b
fix: create PropertyAssignment instead of string literal (Identifier)…
DimitarTachev Jul 1, 2019
7d18cc1
fix: unify the TypeScript version with the Angular App (trying to fix…
DimitarTachev Jul 2, 2019
f558607
feat(hooks): improve hooks handling (#961)
rosen-vladimirov Jul 2, 2019
b00fcdd
Merge pull request #957 from NativeScript/fatme/fix-ng-uglify
Fatme Jul 2, 2019
90846e1
Merge pull request #959 from NativeScript/tachev/fix-ng-lazy-exception
Jul 2, 2019
8c4292e
fix: allow overriding the `global.process` object from both the app a…
DimitarTachev Jul 3, 2019
804030f
Merge pull request #962 from NativeScript/tachev/fix-process-polyfill
Jul 3, 2019
47ad5cf
Merge pull request #908 from mudlabs/dependencies
Jul 3, 2019
7586d4c
fix: avoid generating invalid JavaScript when merging IIFE files
DimitarTachev Jul 4, 2019
1a9c4b2
fix: log the real snapshot tool error by trying to evaluate the input…
DimitarTachev Jul 4, 2019
994d6a2
Merge pull request #965 from NativeScript/tachev/fix-uglfiy-sourcemap…
Jul 5, 2019
d3b5cab
test: update tests to ns-dev-appium v6 (#969)
SvetoslavTsenov Jul 8, 2019
d4a8dec
refactor: HMR and webpack improvements (#966)
Jul 8, 2019
f1e8081
fix: hmr export default crash (#970)
Jul 8, 2019
35d7385
fix: default export crash (#971)
Jul 8, 2019
f48bd8c
fix: handle the `bundle-config-loader` require.context change without…
Jul 9, 2019
bd893ce
fix: auto accept new or deleted files (#972)
Jul 10, 2019
aa4442a
fix: require automatically only files from app folder of unit-test-ru…
Fatme Jul 10, 2019
f5b21e6
fix: add loader-utils as dep instead of dev-dep (#975)
Jul 10, 2019
dbd8c8d
Merge pull request #974 from NativeScript/fatme/fix-unit-test-runner
Fatme Jul 10, 2019
5423504
fix: fix the execution of unit tests with latest unit-test-runner and…
Fatme Jul 10, 2019
cf74631
release: cut the 1.0.0 release (#977)
Jul 10, 2019
f88d2e1
chore: merge 'release' into vladimirov/merge-rel-master
rosen-vladimirov Jul 15, 2019
0585a91
chore: bump version to 1.1.0
rosen-vladimirov Jul 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@
node_modules
*.tgz
package-lock.json
*.js.map

plugins/NativeScriptAngularCompilerPlugin.d.ts
plugins/NativeScriptAngularCompilerPlugin.js
plugins/NativeScriptAngularCompilerPlugin.js.map

transformers/*.d.ts
transformers/*.js
transformers/*.js.map

utils/*.d.ts
utils/*.js
utils/*.js.map

hmr/*.d.ts
hmr/*.js

plugins/PlatformFSPlugin.d.ts
plugins/PlatformFSPlugin.js
plugins/PlatformFSPlugin.js.map

plugins/WatchStateLoggerPlugin.d.ts
plugins/WatchStateLoggerPlugin.js
plugins/WatchStateLoggerPlugin.js.map

host/resolver.d.ts
host/resolver.js
host/resolver.js.map

jasmine-config/reporter.d.ts
jasmine-config/reporter.js
jasmine-config/reporter.js.map

bundle-config-loader.d.ts
bundle-config-loader.js

**/*.spec.js*
**/*.spec.d.ts*
Expand Down
10 changes: 10 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
"args": [ "--env.android", "--env.aot" ],
"runtimeArgs": [ "--preserve-symlinks" ],
"stopOnEntry": true,
},
{
"type": "node",
"request": "launch",
"name": "TypeScriptApp Webpack",
"cwd": "${workspaceFolder}/demo/TypeScriptApp",
"program": "${workspaceFolder}/demo/TypeScriptApp/node_modules/.bin/webpack",
"args": [ "--env.android" ],
"stopOnEntry": true,
"preLaunchTask": "npm:tsc"
}
]
}
13 changes: 13 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label":"npm:tsc",
"type": "npm",
"script": "tsc",
"problemMatcher": []
}
]
}
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
<a name="1.0.0"></a>
# [1.0.0](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.24.1...1.0.0) (2019-07-10)


### Bug Fixes

* allow overriding the `global.process` object from both the app and the plugins ([8c4292e](https://github.com/NativeScript/nativescript-dev-webpack/commit/8c4292e))
* 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))
* avoid generating invalid JavaScript when merging IIFE files ([7586d4c](https://github.com/NativeScript/nativescript-dev-webpack/commit/7586d4c))
* 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))
* do not add inspector_modules entry when core modules are an external module ([e0cd8c1](https://github.com/NativeScript/nativescript-dev-webpack/commit/e0cd8c1))
* 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))
* 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))
* emit inspector_modules as a module ([be2a5a6](https://github.com/NativeScript/nativescript-dev-webpack/commit/be2a5a6))
* fix app.css file path on windows machines ([7d734d8](https://github.com/NativeScript/nativescript-dev-webpack/commit/7d734d8))
* 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))
* 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))
* 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))
* **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))
* 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))
* log the real snapshot tool error by trying to evaluate the input file script ([1a9c4b2](https://github.com/NativeScript/nativescript-dev-webpack/commit/1a9c4b2))
* migrate demo apps to android x ([c2d6684](https://github.com/NativeScript/nativescript-dev-webpack/commit/c2d6684))
* unify the entry points handling and enable custom applications in android ([de10041](https://github.com/NativeScript/nativescript-dev-webpack/commit/de10041))
* **hooks:** improve hooks handling ([#961](https://github.com/NativeScript/nativescript-dev-webpack/issues/961)) ([f558607](https://github.com/NativeScript/nativescript-dev-webpack/commit/f558607))

### Features

* introduce webpack only workflow ([#882](https://github.com/NativeScript/nativescript-dev-webpack/issues/882)) ([2de4c68](https://github.com/NativeScript/nativescript-dev-webpack/commit/2de4c68))
* 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))
* support for file qualifiers ([#966](https://github.com/NativeScript/nativescript-dev-webpack/pull/966)) ([d4a8dec](https://github.com/NativeScript/nativescript-dev-webpack/commit/d4a8dec803acf39b7cdeb4f3bc8c23284046fe67))
* universal hmr loader ([#966](https://github.com/NativeScript/nativescript-dev-webpack/pull/966)) ([d4a8dec](https://github.com/NativeScript/nativescript-dev-webpack/commit/d4a8dec803acf39b7cdeb4f3bc8c23284046fe67))

### BREAKING CHANGES:

* 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.

* the plugin is not working with NativeScript CLI older than 6.0.0 (`[email protected]`).

* the Webpack mode it set to `production` based on the `--release` flag of the NativeScript CLI, instead of the `--env.uglify` one.

<a name="0.24.1"></a>
## [0.24.1](https://github.com/NativeScript/nativescript-dev-webpack/compare/0.24.0...0.24.1) (2019-06-06)

Expand Down
37 changes: 33 additions & 4 deletions bundle-config-loader.js → bundle-config-loader.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
const unitTestingConfigLoader = require("./unit-testing-config-loader");
import * as unitTestingConfigLoader from "./unit-testing-config-loader";
import { loader } from "webpack";
import { getOptions } from "loader-utils";
import * as escapeRegExp from "escape-string-regexp";

module.exports = function (source, map) {
this.cacheable();
const { angular = false, loadCss = true, unitTesting, projectRoot, appFullPath, registerModules = /(root|page)\.(xml|css|js|ts|scss)$/ } = this.query;
// Matches all source, markup and style files that are not in App_Resources
const defaultMatch = "(?<!App_Resources.*)\.(xml|css|js|(?<!d\.)ts|scss)$";

const loader: loader.Loader = function (source, map) {
let {
angular = false,
loadCss = true,
unitTesting,
projectRoot,
appFullPath,
registerModules,
ignoredFiles = []
} = getOptions(this);

if (!registerModules) {
registerModules = defaultMatch;
for (const key in ignoredFiles) {
registerModules = `(?<!${escapeRegExp(ignoredFiles[key])})` + registerModules;
}
registerModules = new RegExp(registerModules);
}

if (unitTesting) {
source = unitTestingConfigLoader({ appFullPath, projectRoot, angular, rootPagesRegExp: registerModules });
Expand Down Expand Up @@ -51,6 +72,11 @@ module.exports = function (source, map) {
${hmr}
const context = require.context("~/", true, ${registerModules});
global.registerWebpackModules(context);
if (module.hot) {
module.hot.accept(context.id, () => {
console.log("HMR: Accept module '" + context.id + "' from '" + module.id + "'");
});
}
${source}
`;
}
Expand All @@ -68,3 +94,6 @@ module.exports = function (source, map) {

this.callback(null, source, map);
};


export default loader;
3 changes: 2 additions & 1 deletion demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ tsconfig.aot.json
vendor.js
vendor.ts

tsconfig.esm.json
tsconfig.esm.json
mochawesome-report
7 changes: 2 additions & 5 deletions demo/AngularApp/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
"999999",
"--colors",
"--opts",
"./e2e/config/mocha.opts",
"--runType",
"android23",
"--reuseDevice"
// "${workspaceFolder}/test"
"../config/mocha.opts",
"android"
],
"internalConsoleOptions": "openOnSessionStart"
},
Expand Down
25 changes: 5 additions & 20 deletions demo/AngularApp/e2e/tests.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
import { AppiumDriver, createDriver, SearchOptions } from "nativescript-dev-appium";
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
import { assert } from "chai";

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

before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
});

beforeEach(async function () {
try {
const items = await getItems();
} catch (err) {
try {
const lblNinjas = await driver.findElementByText("Ninjas!");
}
catch (err) {
console.log("Navigating to ninjas page ...");
await driver.navBack();
}
console.log("Navigating to main page ...");
await driver.navBack();
}
});

afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
Expand All @@ -36,7 +21,7 @@ describe("sample scenario", async function () {
});

it("should navigate to a ninja", async function () {
const btnNinjas = await driver.findElementByText("Ninjas");
const btnNinjas = await driver.waitForElement("Ninjas");
await btnNinjas.click();

const itemMichaelangelo = await driver.findElementByText("Michaelangelo");
Expand All @@ -61,10 +46,10 @@ describe("sample scenario", async function () {
for (let styleType in styleTypes) {
it(`should find an element with ${styleType} style applied`, async function () {
const element = await driver.findElementByText(styleTypes[styleType]);
driver.imageHelper.options.keepOriginalImageSize = false;
driver.imageHelper.options.isDeviceSpecific = false;
const result = await driver.compareElement(element, "style");
assert.isTrue(result);
});
}

const getItems = async function () { return driver.isAndroid ? await driver.findElementsByText("(Android)") : await driver.findElementsByText("(ios)"); }
});
1 change: 1 addition & 0 deletions demo/AngularApp/e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"importHelpers": false,
"sourceMap": true,
"types": [
"mocha",
"chai",
Expand Down
3 changes: 2 additions & 1 deletion demo/AngularApp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ module.exports = env => {

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

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

nsWebpack.processAppComponents(appComponents, platform);
const config = {
mode: production ? "production" : "development",
context: appFullPath,
Expand Down Expand Up @@ -214,6 +214,7 @@ module.exports = env => {
unitTesting,
appFullPath,
projectRoot,
ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform)
}
},
].filter(loader => !!loader)
Expand Down
Loading