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

Commit 71bcffa

Browse files
committed
chore: scoped webpack
1 parent 46c146d commit 71bcffa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+235
-892
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
First of all, thank you for taking the time to contribute!
2020

21-
Before starting, make yourself familiar with the `nativescript-dev-webpack`'s [documentation](http://docs.nativescript.org/best-practices/bundling-with-webpack) and the official [NativeScript Code Of Conduct]( https://github.com/NativeScript/codeofconduct).
21+
Before starting, make yourself familiar with the `@nativescript/webpack`'s [documentation](http://docs.nativescript.org/best-practices/bundling-with-webpack) and the official [NativeScript Code Of Conduct]( https://github.com/NativeScript/codeofconduct).
2222

2323
## Project Structure
2424

@@ -67,7 +67,7 @@ NOTE: There are three test apps in the repository, located in the `/demo` direct
6767
cd demo/AngularApp
6868
```
6969
70-
2. Install your local copy of the `nativescript-dev-webpack` plugin.
70+
2. Install your local copy of the `@nativescript/webpack` plugin.
7171
```bash
7272
npm run setup
7373
```

PULL_REQUEST_TESTS.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ This document describes comment messages available to execute tests on pull requ
33
|Comment |Commit Status Context|Description|
44
|:----------------------:|:-------------------:|:---------:|
55
|`run ci` | |Run all below.|
6-
|`js`|ci/jenkins/webpack-js|Pack the *nativescript-dev-webpack* plugin and bundle the [template-hello-world](https://github.com/NativeScript/template-hello-world) template app. |
7-
|`ts`|ci/jenkins/webpack-ts|Pack the *nativescript-dev-webpack* plugin and bundle the [template-hello-world-ts](https://github.com/NativeScript/template-hello-world-ts) template app.|
8-
|`ng`|ci/jenkins/webpack-ng|Pack the *nativescript-dev-webpack* plugin and bundle the [template-hello-world-ng](https://github.com/NativeScript/template-hello-world-ng) template app.|
9-
|`groceries`|ci/jenkins/webpack-groceries|Pack the *nativescript-dev-webpack* plugin and bundle the [Groceries](https://github.com/NativeScript/sample-Groceries) app. |
10-
|`sdk`|ci/jenkins/webpack-sdk|Pack the *nativescript-dev-webpack* plugin and bundle the [SDK](https://github.com/NativeScript/nativescript-sdk-examples-ng) app. |
11-
|`testsappng`|ci/jenkins/webpack-testsappng|Pack the *nativescript-dev-webpack* plugin and bundle the [tests-app-ng](https://github.com/NativeScript/tests-app-ng) app. |
6+
|`js`|ci/jenkins/webpack-js|Pack the *@nativescript/webpack* plugin and bundle the [template-hello-world](https://github.com/NativeScript/template-hello-world) template app. |
7+
|`ts`|ci/jenkins/webpack-ts|Pack the *@nativescript/webpack* plugin and bundle the [template-hello-world-ts](https://github.com/NativeScript/template-hello-world-ts) template app.|
8+
|`ng`|ci/jenkins/webpack-ng|Pack the *@nativescript/webpack* plugin and bundle the [template-hello-world-ng](https://github.com/NativeScript/template-hello-world-ng) template app.|
9+
|`groceries`|ci/jenkins/webpack-groceries|Pack the *@nativescript/webpack* plugin and bundle the [Groceries](https://github.com/NativeScript/sample-Groceries) app. |
10+
|`sdk`|ci/jenkins/webpack-sdk|Pack the *@nativescript/webpack* plugin and bundle the [SDK](https://github.com/NativeScript/nativescript-sdk-examples-ng) app. |
11+
|`testsappng`|ci/jenkins/webpack-testsappng|Pack the *@nativescript/webpack* plugin and bundle the [tests-app-ng](https://github.com/NativeScript/tests-app-ng) app. |

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NativeScript Webpack
22

3-
This repository contains the code for the nativescript-dev-webpack plugin which helps in webpacking [NativeScript](https://www.nativescript.org/) apps.
3+
This repository contains the code for the @nativescript/webpack plugin which helps in webpacking [NativeScript](https://www.nativescript.org/) apps.
44

55
JavaScript code and general asset bundling have been a member of the web developer toolbox for a long time. Tools like Webpack have been providing support for an enjoyable development experience that lets you assemble client-side code from various module sources and formats and then package it together. Most importantly, they allow for page load time optimizations that reduce or parallelize the number of requests a browser makes to the server.
66

@@ -31,7 +31,7 @@ For more details, see the [NativeScript docs for building with webpack](http://d
3131
## Usage
3232

3333
```sh
34-
$ npm install --save-dev nativescript-dev-webpack
34+
$ npm install --save-dev @nativescript/webpack
3535

3636
$ tns run android
3737
or

android-app-components-loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function (source, map) {
66
const imports = modules.map(convertSlashesInPath)
77
.map(m => `require("${m}");`).join("\n");
88
const augmentedSource = `
9-
let applicationCheckPlatform = require("tns-core-modules/application");
9+
let applicationCheckPlatform = require("@nativescript/core/application");
1010
if (applicationCheckPlatform.android && !global["__snapshot"]) {
1111
${imports}
1212
}

apply-css-loader.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ module.exports = function (content, map) {
2626
}
2727

2828
content += `
29-
const application = require("tns-core-modules/application");
30-
require("tns-core-modules/ui/styling/style-scope");
29+
const application = require("@nativescript/core/application");
30+
require("@nativescript/core/ui/styling/style-scope");
3131
3232
if (typeof exports.forEach === "function") {
3333
exports.forEach(cssExport => {

bundle-config-loader.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const loader: loader.Loader = function (source, map) {
3434

3535
const hmr = `
3636
if (module.hot) {
37-
const hmrUpdate = require("nativescript-dev-webpack/hmr").hmrUpdate;
37+
const hmrUpdate = require("@nativescript/webpack/hmr").hmrUpdate;
3838
global.__coreModulesLiveSync = global.__onLiveSync;
3939
4040
global.__onLiveSync = function () {
@@ -54,7 +54,7 @@ const loader: loader.Loader = function (source, map) {
5454
}
5555
`;
5656

57-
let sourceModule = "tns-core-modules";
57+
let sourceModule = "@nativescript/core";
5858

5959
if (platform && platform !== "ios" && platform !== "android") {
6060
sourceModule = `nativescript-platform-${platform}`;
@@ -88,8 +88,8 @@ const loader: loader.Loader = function (source, map) {
8888
source = `
8989
require("${
9090
angular ?
91-
'nativescript-dev-webpack/load-application-css-angular' :
92-
'nativescript-dev-webpack/load-application-css-regular'
91+
'@nativescript/webpack/load-application-css-angular' :
92+
'@nativescript/webpack/load-application-css-regular'
9393
}")();
9494
${source}
9595
`;

css2json-loader.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe("css2jsonLoader", () => {
5252
it("inlines css2json loader in imports if option is provided", (done) => {
5353
const loaderContext = {
5454
callback: (error, source: string, map) => {
55-
expect(source).toContain(`global.registerModule("./custom.css", () => require("!nativescript-dev-webpack/css2json-loader?useForImports!./custom.css"))`);
55+
expect(source).toContain(`global.registerModule("./custom.css", () => require("!@nativescript/webpack/css2json-loader?useForImports!./custom.css"))`);
5656
expect(source).toContain(`{"type":"declaration","property":"background-color","value":"#7f9"}`);
5757

5858
done();

css2json-loader.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getOptions, urlToRequest } from "loader-utils";
44

55
const betweenQuotesPattern = /('|")(.*?)\1/;
66
const unpackUrlPattern = /url\(([^\)]+)\)/;
7-
const inlineLoader = "!nativescript-dev-webpack/css2json-loader?useForImports!"
7+
const inlineLoader = "!@nativescript/webpack/css2json-loader?useForImports!"
88

99
const loader: loader.Loader = function (content: string, map) {
1010
const options = getOptions(this) || {};

demo/AngularApp/app/activity.android.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { setActivityCallbacks, AndroidActivityCallbacks } from "tns-core-modules/ui/frame";
1+
import { setActivityCallbacks, AndroidActivityCallbacks } from "@nativescript/core/ui/frame";
22

33
@JavaProxy("org.myApp.MainActivity")
44
class Activity extends androidx.appcompat.app.AppCompatActivity {

demo/AngularApp/app/app.module.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
2-
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
2+
import { NativeScriptModule } from "@nativescript/angular";
33
import { AppRoutingModule } from "./app.routing";
44
import { AppComponent } from "./app.component";
55

@@ -10,10 +10,10 @@ import { ItemDetailComponent } from "./item/item-detail.component";
1010
// import { PlayfulSpirit } from "./directive";
1111

1212
// Uncomment and add to NgModule imports if you need to use two-way binding
13-
// import { NativeScriptFormsModule } from "nativescript-angular/forms";
13+
// import { NativeScriptFormsModule } from "@nativescript/angular";
1414

1515
// Uncomment and add to NgModule imports if you need to use the HTTP wrapper
16-
// import { NativeScriptHttpModule } from "nativescript-angular/http";
16+
// import { NativeScriptHttpModule } from "@nativescript/angular";
1717

1818
@NgModule({
1919
bootstrap: [

demo/AngularApp/app/app.routing.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgModule } from "@angular/core";
2-
import { NativeScriptRouterModule } from "nativescript-angular/router";
2+
import { NativeScriptRouterModule } from "@nativescript/angular";
33
import { Routes } from "@angular/router";
44

55
import { ItemsComponent } from "./item/items.component";
@@ -11,7 +11,7 @@ const routes: Routes = [
1111
{ path: "item/:id", component: ItemDetailComponent },
1212
{
1313
path: "ninjas",
14-
loadChildren: "./ninjas/ninjas.module#NinjasModule",
14+
loadChildren: () => import("./ninjas/ninjas.module").then(m => m.NinjasModule)
1515
},
1616

1717
];

demo/AngularApp/app/main.aot.ts

-7
This file was deleted.

demo/AngularApp/app/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// this import should be first in order to load some required settings (like globals and reflect-metadata)
2-
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
2+
import { platformNativeScript } from "@nativescript/angular";
33
import { AppModule } from "./app.module";
44

5-
platformNativeScriptDynamic().bootstrapModule(AppModule);
5+
platformNativeScript().bootstrapModule(AppModule);

demo/AngularApp/app/ninjas/details/ninja.module.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { NativeScriptCommonModule } from "nativescript-angular/common";
1+
import { NativeScriptCommonModule, NativeScriptRouterModule } from "@nativescript/angular";
22
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
3-
import { NativeScriptRouterModule } from "nativescript-angular/router";
43

54
import { NinjaComponent } from "./ninja.component";
65
import { routes } from "./ninja.routes";

demo/AngularApp/app/ninjas/ninjas.module.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { NativeScriptCommonModule } from "nativescript-angular/common";
1+
import { NativeScriptCommonModule, NativeScriptRouterModule } from "@nativescript/angular";
22
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
3-
import { NativeScriptRouterModule } from "nativescript-angular/router";
43

54
import { NinjasComponent } from "./ninjas.component";
65
import { routes } from "./ninjas.routes";

demo/AngularApp/package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
}
1414
},
1515
"dependencies": {
16-
"@angular/common": "8.2.0",
17-
"@angular/compiler": "8.2.0",
18-
"@angular/core": "8.2.0",
19-
"@angular/forms": "8.2.0",
20-
"@angular/platform-browser": "8.2.0",
21-
"@angular/platform-browser-dynamic": "8.2.0",
22-
"@angular/router": "8.2.0",
23-
"nativescript-angular": "next",
16+
"@angular/common": "~10.0.0",
17+
"@angular/compiler": "~10.0.0",
18+
"@angular/core": "~10.0.0",
19+
"@angular/forms": "~10.0.0",
20+
"@angular/platform-browser": "~10.0.0",
21+
"@angular/platform-browser-dynamic": "~10.0.0",
22+
"@angular/router": "~10.0.0",
23+
"@nativescript/angular": "next",
24+
"@nativescript/core": "next",
2425
"nativescript-theme-core": "~1.0.2",
2526
"reflect-metadata": "~0.1.8",
26-
"rxjs": "^6.3.3",
27-
"tns-core-modules": "next",
28-
"zone.js": "^0.9.1"
27+
"rxjs": "^6.5.5",
28+
"zone.js": "^0.10.3"
2929
},
3030
"devDependencies": {
31-
"@angular/compiler-cli": "8.2.0",
32-
"@ngtools/webpack": "8.2.0",
31+
"@angular/compiler-cli": "~10.0.0",
32+
"@ngtools/webpack": "~10.0.0",
3333
"@types/chai": "~4.1.7",
3434
"@types/mocha": "~5.2.5",
3535
"@types/node": "~10.12.18",
@@ -42,12 +42,12 @@
4242
"chai": "4.2.0",
4343
"mochawesome": "~3.1.2",
4444
"nativescript-dev-appium": "next",
45-
"nativescript-dev-webpack": "next",
45+
"@nativescript/webpack": "next",
4646
"node-sass": "^4.12.0",
47-
"typescript": "~3.5.3"
47+
"typescript": "~3.9.0"
4848
},
4949
"scripts": {
50-
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",
50+
"setup": "npm pack ../../ && npm i -D nativescript-webpack*.tgz",
5151
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
5252
"compile-tests": "tsc -p e2e --watch"
5353
}

demo/AngularApp/tsconfig.json

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
"paths": {
1616
"~/*": [
1717
"app/*"
18-
],
19-
"*": [
20-
"./node_modules/tns-core-modules/*",
21-
"./node_modules/*"
2218
]
2319
}
2420
},

demo/JavaScriptApp/app/activity.android.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const frame = require("tns-core-modules/ui/frame");
1+
const frame = require("@nativescript/core/ui/frame");
22

33
const superProto = androidx.appcompat.app.AppCompatActivity.prototype;
44
androidx.appcompat.app.AppCompatActivity.extend("org.myApp.MainActivity", {

demo/JavaScriptApp/app/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ You can use this file to perform app-level initialization, but the primary
44
purpose of the file is to pass control to the app’s first module.
55
*/
66

7-
var application = require("tns-core-modules/application");
7+
var application = require("@nativescript/core/application");
88

99
application.run({ moduleName: "app-root" });
1010

demo/JavaScriptApp/app/main-page.android.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var frameModule = require("tns-core-modules/ui/frame");
1+
var frameModule = require("@nativescript/core/ui/frame");
22
var createViewModel = require("./main-view-model").createViewModel;
33

44
function onNavigatingTo(args) {

demo/JavaScriptApp/app/main-page.ios.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var frameModule = require("tns-core-modules/ui/frame");
1+
var frameModule = require("@nativescript/core/ui/frame");
22
var createViewModel = require("./main-view-model").createViewModel;
33

44
function onNavigatingTo(args) {

demo/JavaScriptApp/app/main-view-model.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var Observable = require("tns-core-modules/data/observable").Observable;
1+
var Observable = require("@nativescript/core/data/observable").Observable;
22

33
function getMessage(counter) {
44
if (counter <= 0) {

demo/JavaScriptApp/app/references.d.ts

-1
This file was deleted.

demo/JavaScriptApp/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"nativescript-theme-core": "~1.0.2",
17-
"tns-core-modules": "next"
17+
"@nativescript/core": "~6.5.8"
1818
},
1919
"devDependencies": {
2020
"@types/chai": "~4.1.7",
@@ -28,11 +28,11 @@
2828
"mocha": "~5.2.0",
2929
"mochawesome": "~3.1.2",
3030
"nativescript-dev-appium": "next",
31-
"nativescript-dev-webpack": "next",
31+
"@nativescript/webpack": "next",
3232
"node-sass": "4.12.0"
3333
},
3434
"scripts": {
35-
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",
35+
"setup": "npm pack ../../ && npm i -D nativescript-webpack*.tgz",
3636
"e2e": "mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json"
3737
}
3838
}

demo/TypeScriptApp/app/activity.android.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {setActivityCallbacks, AndroidActivityCallbacks} from "tns-core-modules/ui/frame";
1+
import {setActivityCallbacks, AndroidActivityCallbacks} from "@nativescript/core/ui/frame";
22

33
@JavaProxy("org.myApp.MainActivity")
44
class Activity extends androidx.appcompat.app.AppCompatActivity {

demo/TypeScriptApp/app/app.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ You can use this file to perform app-level initialization, but the primary
44
purpose of the file is to pass control to the app’s first module.
55
*/
66

7-
import * as app from 'tns-core-modules/application';
7+
import * as app from '@nativescript/core/application';
88

99
app.run({ moduleName: "app-root" });
1010

demo/TypeScriptApp/app/main-page.android.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ a code-behind file. The code-behind is a great place to place your view
44
logic, and to set up your page’s data binding.
55
*/
66

7-
import { EventData } from 'tns-core-modules/data/observable';
8-
import { Page } from 'tns-core-modules/ui/page';
9-
import { Label } from 'tns-core-modules/ui/label';
10-
import * as frameModule from 'tns-core-modules/ui/frame';
7+
import { EventData, Page, Label, Frame } from '@nativescript/core';
118
import { HelloWorldModel } from './main-view-model';
129

1310
export function onNavigatingTo(args: EventData) {
@@ -17,6 +14,6 @@ export function onNavigatingTo(args: EventData) {
1714
}
1815

1916
export function goToSecondPage(args) {
20-
var topmost = frameModule.topmost();
17+
var topmost = Frame.topmost();
2118
topmost.navigate("views/second-page");
2219
}

demo/TypeScriptApp/app/main-page.ios.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ a code-behind file. The code-behind is a great place to place your view
44
logic, and to set up your page’s data binding.
55
*/
66

7-
import { EventData } from 'tns-core-modules/data/observable';
8-
import { Page } from 'tns-core-modules/ui/page';
7+
import { EventData, Page, Label, Frame } from '@nativescript/core';
98
import { HelloWorldModel } from './main-view-model';
10-
import { Label } from 'tns-core-modules/ui/label';
11-
import * as frameModule from 'tns-core-modules/ui/frame';
129

1310
// Event handler for Page "navigatingTo" event attached in main-page.xml
1411
export function onNavigatingTo(args: EventData) {
@@ -35,6 +32,6 @@ export function onNavigatingTo(args: EventData) {
3532
}
3633

3734
export function goToSecondPage(args) {
38-
var topmost = frameModule.topmost();
35+
var topmost = Frame.topmost();
3936
topmost.navigate("views/second-page");
4037
}

demo/TypeScriptApp/app/main-view-model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Observable} from 'tns-core-modules/data/observable';
1+
import {Observable} from '@nativescript/core';
22

33
export class HelloWorldModel extends Observable {
44

demo/TypeScriptApp/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"nativescript-theme-core": "~1.0.2",
17-
"tns-core-modules": "next"
17+
"@nativescript/core": "~6.5.8"
1818
},
1919
"devDependencies": {
2020
"@types/chai": "~4.1.7",
@@ -28,12 +28,12 @@
2828
"chai": "4.2.0",
2929
"mochawesome": "~3.1.2",
3030
"nativescript-dev-appium": "next",
31-
"nativescript-dev-webpack": "next",
31+
"@nativescript/webpack": "next",
3232
"typescript": "~3.4.1",
3333
"node-sass": "^4.12.0"
3434
},
3535
"scripts": {
36-
"setup": "npm pack ../../ && npm i -D nativescript-dev-webpack*.tgz",
36+
"setup": "npm pack ../../ && npm i -D nativescript-webpack*.tgz",
3737
"e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json",
3838
"compile-tests": "tsc -p e2e --watch"
3939
}

0 commit comments

Comments
 (0)