├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── after-prepare-hook.js
├── demo
├── app
│ ├── App_Resources
│ │ ├── Android
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── app.gradle
│ │ │ ├── drawable-hdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ ├── drawable-ldpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ ├── drawable-mdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ ├── drawable-nodpi
│ │ │ │ └── splash_screen.xml
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ ├── drawable-xxxhdpi
│ │ │ │ ├── background.png
│ │ │ │ ├── icon.png
│ │ │ │ └── logo.png
│ │ │ ├── values-v21
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ └── values
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ └── iOS
│ │ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── icon-29.png
│ │ │ │ ├── icon-29@2x.png
│ │ │ │ ├── icon-29@3x.png
│ │ │ │ ├── icon-40.png
│ │ │ │ ├── icon-40@2x.png
│ │ │ │ ├── icon-40@3x.png
│ │ │ │ ├── icon-50.png
│ │ │ │ ├── icon-50@2x.png
│ │ │ │ ├── icon-57.png
│ │ │ │ ├── icon-57@2x.png
│ │ │ │ ├── icon-60@2x.png
│ │ │ │ ├── icon-60@3x.png
│ │ │ │ ├── icon-72.png
│ │ │ │ ├── icon-72@2x.png
│ │ │ │ ├── icon-76.png
│ │ │ │ ├── icon-76@2x.png
│ │ │ │ └── icon-83.5@2x.png
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.launchimage
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Default-568h@2x.png
│ │ │ │ ├── Default-667h@2x.png
│ │ │ │ ├── Default-736h@3x.png
│ │ │ │ ├── Default-Landscape.png
│ │ │ │ ├── Default-Landscape@2x.png
│ │ │ │ ├── Default-Landscape@3x.png
│ │ │ │ ├── Default-Portrait.png
│ │ │ │ ├── Default-Portrait@2x.png
│ │ │ │ ├── Default.png
│ │ │ │ └── Default@2x.png
│ │ │ ├── LaunchScreen.AspectFill.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchScreen-AspectFill.png
│ │ │ │ └── LaunchScreen-AspectFill@2x.png
│ │ │ └── LaunchScreen.Center.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchScreen-Center.png
│ │ │ │ └── LaunchScreen-Center@2x.png
│ │ │ ├── Info.plist
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── build.xcconfig
│ ├── app.css
│ ├── app.js
│ ├── main-page.js
│ ├── main-page.xml
│ ├── main-view-model.js
│ ├── package.json
│ └── references.d.ts
├── filter-modules.json
├── hooks
│ └── after-prepare
│ │ └── nativescript-hook-filter-modules.js
└── package.json
├── filter-modules.json.template
├── index.js
├── package.json
├── postinstall.js
└── preuninstall.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vscode/
3 | .tscache/
4 | /demo/node_modules/
5 | /demo/platforms/
6 | node_modules/
7 | .settings/
8 |
9 | .DS_Store
10 | *.js.map
11 | *.tar
12 | *.tgz
13 | *.gz
14 | *.zip
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | demo/
2 | .git/
3 | .idea/
4 | docs/
5 | bin/
6 | tests/
7 | screenshots/
8 | graphics/
9 | .vs/
10 | .settings/
11 | .vscode/
12 | node_modules/
13 | .tscache/
14 |
15 | .gitignore
16 | .npmignore
17 | .DS_Store
18 | .editorconfig
19 | .bablerc
20 | .eslintignore
21 | .travis.yml
22 | .jshintrc
23 | *.sln
24 | *.md
25 | *.tmp
26 | *.log
27 | *.ts
28 | *.js.map
29 | *.tar
30 | *.tgz
31 | *.gz
32 | *.zip
33 |
34 | references.d.ts
35 | tsconfig.json
36 | tslint.json
37 | karma.conf.js
38 | typings.json
39 | typedoc.json
40 |
41 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | nativescript-hook-filter-modules
4 | Copyright (c) 2016, Marek Maszay
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of
7 | this software and associated documentation files (the "Software"), to deal in
8 | the Software without restriction, including without limitation the rights to
9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10 | the Software, and to permit persons to whom the Software is furnished to do so,
11 | subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # NativeScript-hook-filter-modules
2 | Shrinking size of built application by deleting defined set of node_modules inside tns_modules
3 |
4 |
5 | ## License
6 | This plugin is licensed under the MIT license by Marek Maszay
7 |
8 | ## Installation
9 |
10 | ```
11 | tns plugin add nativescript-hook-filter-modules
12 | ```
13 |
14 | ## Usages
15 |
16 | You don't use all the modules exposed by NativeScript in the core-modules. By default they're bundled with your application during a build.
17 | This leads to a larger file size in the end. This hook will remove those modules during the build phase to reduce the overall application size.
18 | This isn't as sophisticated as webpack but it works and is pretty simple to setup and use to reduce your app size on the device.
19 |
20 | The more you remove the smaller the final build will be of course. Remove only what you don't need or the app will crash if it tries to require a module.
21 | This is easily fixed by updating the filter-modules.json and rebuilding your application.
22 |
23 | ## Example
24 |
25 | ##### filter-modules.json
26 | In this example the hook will remove the `connectivity` module from your built application.
27 | ```
28 | {
29 | "to_be_deleted": [
30 | "connectivity"
31 | ],
32 | "to_be_kept": [
33 |
34 | ]
35 | }
36 | ```
37 |
--------------------------------------------------------------------------------
/after-prepare-hook.js:
--------------------------------------------------------------------------------
1 | var path = require("path");
2 | var shelljs = require("shelljs");
3 | var fs = require('fs');
4 | var findRemoveSync = require('find-remove')
5 | module.exports = function (logger, platformsData, projectData, hookArgs) {
6 |
7 | var deletedFileCounter=0;
8 |
9 | var projectDir = projectData.projectDir;
10 | var platform = hookArgs.platform.toLowerCase();
11 | process.env.PLATFORM = platform;
12 |
13 | var platformData = platformsData.getPlatformData(platform);
14 | var platformOutDir = platformData.appDestinationDirectoryPath;
15 | var platformAppDir = path.join(platformOutDir, "app");
16 | platformAppDir = path.join(platformAppDir, "tns_modules");
17 | process.env.PLATFORM_DIR = platformOutDir;
18 |
19 | var SubDirs_to_be_kept=[];
20 | var SubDirs_to_be_deleted=[];
21 |
22 | var Dirs_to_be_kept=[
23 | "application",
24 | "application-settings",
25 | "camera",
26 | "color",
27 | "connectivity",
28 | "console",
29 | "css",
30 | "css-value",
31 | "data",
32 | "debugger",
33 | "fetch",
34 | "file-system",
35 | "fps-meter",
36 | "globals",
37 | "http",
38 | "image-source",
39 | "ios",
40 | "js-libs",
41 | "location",
42 | "platform",
43 | "text",
44 | "timer",
45 | "trace",
46 | "ui",
47 | "utils",
48 | "xhr",
49 | "xml",
50 | "tns-core-modules-widgets",
51 | "@angular",
52 | "nativescript-angular",
53 | "nativescript-intl",
54 | "reflect-metadata",
55 | "zone.js",
56 | "rxjs",
57 | "parse5"
58 | ];
59 | var Dirs_to_be_deleted=[
60 | "nativescript-hook-filter-modules"
61 | ];
62 |
63 |
64 |
65 | try{
66 | var dirs=getDirectories(platformAppDir);
67 | var JSONFilterFiles=readPackageJson(projectDir);
68 | Dirs_to_be_kept=Dirs_to_be_kept.concat(JSONFilterFiles.to_be_kept);
69 | Dirs_to_be_deleted=Dirs_to_be_deleted.concat(JSONFilterFiles.to_be_deleted);
70 |
71 |
72 | Dirs_to_be_deleted.forEach(function(item){
73 | if(item.indexOf("/")>-1){
74 | SubDirs_to_be_deleted.push(item);
75 | }
76 | });
77 |
78 | dirs.forEach(function(item,index){
79 | if(item=="trace")return;
80 | var delFolder = Dirs_to_be_kept.indexOf(item)==-1;
81 | if(item.indexOf("nativescript-")>-1 && item.indexOf("nativescript-dev-")==-1 && item.indexOf(Dirs_to_be_deleted)==-1){
82 | delFolder=false;
83 | }
84 | if(Dirs_to_be_deleted.indexOf(item)>-1){
85 | delFolder=true;
86 | }
87 | if(delFolder){
88 | var delPath=path.join(platformAppDir, item);
89 | if(fs.existsSync(delPath)){
90 | var result = findRemoveSync(delPath, {dir: "*", files: "*.*"});
91 | console.log(result);
92 | if(fs.existsSync(delPath)){
93 | fs.rmdirSync(delPath);
94 | }
95 | }
96 | }
97 | });
98 |
99 | SubDirs_to_be_deleted.forEach(function(item){
100 | if(item=="trace")return;
101 | var delPath=path.join(platformAppDir, item);
102 | if(fs.existsSync(delPath)){
103 | var result = findRemoveSync(delPath, {dir: "*", files: "*.*"});
104 | console.log(result);
105 | if(fs.existsSync(delPath)){
106 | fs.rmdirSync(delPath);
107 | }
108 | }
109 | });
110 |
111 | result = findRemoveSync(path.join(platformOutDir, "app"), {extensions: ['.ts','.md','.MD','.map']});
112 |
113 | if(result!={})console.log(result);
114 | result = findRemoveSync(path.join(platformOutDir, "app"), {files: ['LICENSE','.gitignore','.npmignore']});
115 | if(result!={})console.log(result);
116 |
117 | }catch(e){
118 | console.log(e);
119 | console.log('Shrinking failed.');
120 |
121 | }
122 |
123 | };
124 |
125 |
126 |
127 | function getDirectories(srcpath) {
128 | return fs.readdirSync(srcpath).filter(function(file) {
129 | return fs.statSync(path.join(srcpath, file)).isDirectory();
130 | });
131 | }
132 |
133 | function readPackageJson(dir) {
134 | var packageJson = path.join(dir, "filter-modules.json");
135 | if (shelljs.test("-f", packageJson)) {
136 | return JSON.parse(shelljs.cat(packageJson));
137 | } else {
138 | return {};
139 | }
140 | };
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
28 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/app.gradle:
--------------------------------------------------------------------------------
1 | // Add your native dependencies here:
2 |
3 | // Uncomment to add recyclerview-v7 dependency
4 | //dependencies {
5 | // compile 'com.android.support:recyclerview-v7:+'
6 | //}
7 |
8 | android {
9 | defaultConfig {
10 | generatedDensities = []
11 | applicationId = "org.nativescript.demo"
12 | }
13 | aaptOptions {
14 | additionalParameters "--no-version-vectors"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-hdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-hdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-hdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-ldpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-ldpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-ldpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-ldpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-mdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-mdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-mdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-mdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 | -
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xxhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/values-v21/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3d5afe
4 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
14 |
15 |
16 |
19 |
20 |
23 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F5F5F5
4 | #757575
5 | #33B5E5
6 | #272734
7 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
21 |
22 |
23 |
31 |
32 |
34 |
35 |
36 |
42 |
43 |
45 |
46 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "29x29",
5 | "idiom" : "iphone",
6 | "filename" : "icon-29.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "29x29",
11 | "idiom" : "iphone",
12 | "filename" : "icon-29@2x.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "icon-29@3x.png",
19 | "scale" : "3x"
20 | },
21 | {
22 | "size" : "40x40",
23 | "idiom" : "iphone",
24 | "filename" : "icon-40@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "icon-40@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "57x57",
35 | "idiom" : "iphone",
36 | "filename" : "icon-57.png",
37 | "scale" : "1x"
38 | },
39 | {
40 | "size" : "57x57",
41 | "idiom" : "iphone",
42 | "filename" : "icon-57@2x.png",
43 | "scale" : "2x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "icon-60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "icon-60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "29x29",
59 | "idiom" : "ipad",
60 | "filename" : "icon-29.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "29x29",
65 | "idiom" : "ipad",
66 | "filename" : "icon-29@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "40x40",
71 | "idiom" : "ipad",
72 | "filename" : "icon-40.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "40x40",
77 | "idiom" : "ipad",
78 | "filename" : "icon-40@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "50x50",
83 | "idiom" : "ipad",
84 | "filename" : "icon-50.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "50x50",
89 | "idiom" : "ipad",
90 | "filename" : "icon-50@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "72x72",
95 | "idiom" : "ipad",
96 | "filename" : "icon-72.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "72x72",
101 | "idiom" : "ipad",
102 | "filename" : "icon-72@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "76x76",
107 | "idiom" : "ipad",
108 | "filename" : "icon-76.png",
109 | "scale" : "1x"
110 | },
111 | {
112 | "size" : "76x76",
113 | "idiom" : "ipad",
114 | "filename" : "icon-76@2x.png",
115 | "scale" : "2x"
116 | },
117 | {
118 | "size" : "83.5x83.5",
119 | "idiom" : "ipad",
120 | "filename" : "icon-83.5@2x.png",
121 | "scale" : "2x"
122 | }
123 | ],
124 | "info" : {
125 | "version" : 1,
126 | "author" : "xcode"
127 | }
128 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "extent" : "full-screen",
5 | "idiom" : "iphone",
6 | "subtype" : "736h",
7 | "filename" : "Default-736h@3x.png",
8 | "minimum-system-version" : "8.0",
9 | "orientation" : "portrait",
10 | "scale" : "3x"
11 | },
12 | {
13 | "extent" : "full-screen",
14 | "idiom" : "iphone",
15 | "subtype" : "736h",
16 | "filename" : "Default-Landscape@3x.png",
17 | "minimum-system-version" : "8.0",
18 | "orientation" : "landscape",
19 | "scale" : "3x"
20 | },
21 | {
22 | "extent" : "full-screen",
23 | "idiom" : "iphone",
24 | "subtype" : "667h",
25 | "filename" : "Default-667h@2x.png",
26 | "minimum-system-version" : "8.0",
27 | "orientation" : "portrait",
28 | "scale" : "2x"
29 | },
30 | {
31 | "orientation" : "portrait",
32 | "idiom" : "iphone",
33 | "filename" : "Default@2x.png",
34 | "extent" : "full-screen",
35 | "minimum-system-version" : "7.0",
36 | "scale" : "2x"
37 | },
38 | {
39 | "extent" : "full-screen",
40 | "idiom" : "iphone",
41 | "subtype" : "retina4",
42 | "filename" : "Default-568h@2x.png",
43 | "minimum-system-version" : "7.0",
44 | "orientation" : "portrait",
45 | "scale" : "2x"
46 | },
47 | {
48 | "orientation" : "portrait",
49 | "idiom" : "ipad",
50 | "filename" : "Default-Portrait.png",
51 | "extent" : "full-screen",
52 | "minimum-system-version" : "7.0",
53 | "scale" : "1x"
54 | },
55 | {
56 | "orientation" : "landscape",
57 | "idiom" : "ipad",
58 | "filename" : "Default-Landscape.png",
59 | "extent" : "full-screen",
60 | "minimum-system-version" : "7.0",
61 | "scale" : "1x"
62 | },
63 | {
64 | "orientation" : "portrait",
65 | "idiom" : "ipad",
66 | "filename" : "Default-Portrait@2x.png",
67 | "extent" : "full-screen",
68 | "minimum-system-version" : "7.0",
69 | "scale" : "2x"
70 | },
71 | {
72 | "orientation" : "landscape",
73 | "idiom" : "ipad",
74 | "filename" : "Default-Landscape@2x.png",
75 | "extent" : "full-screen",
76 | "minimum-system-version" : "7.0",
77 | "scale" : "2x"
78 | },
79 | {
80 | "orientation" : "portrait",
81 | "idiom" : "iphone",
82 | "filename" : "Default.png",
83 | "extent" : "full-screen",
84 | "scale" : "1x"
85 | },
86 | {
87 | "orientation" : "portrait",
88 | "idiom" : "iphone",
89 | "filename" : "Default@2x.png",
90 | "extent" : "full-screen",
91 | "scale" : "2x"
92 | },
93 | {
94 | "orientation" : "portrait",
95 | "idiom" : "iphone",
96 | "filename" : "Default-568h@2x.png",
97 | "extent" : "full-screen",
98 | "subtype" : "retina4",
99 | "scale" : "2x"
100 | },
101 | {
102 | "orientation" : "portrait",
103 | "idiom" : "ipad",
104 | "extent" : "to-status-bar",
105 | "scale" : "1x"
106 | },
107 | {
108 | "orientation" : "portrait",
109 | "idiom" : "ipad",
110 | "filename" : "Default-Portrait.png",
111 | "extent" : "full-screen",
112 | "scale" : "1x"
113 | },
114 | {
115 | "orientation" : "landscape",
116 | "idiom" : "ipad",
117 | "extent" : "to-status-bar",
118 | "scale" : "1x"
119 | },
120 | {
121 | "orientation" : "landscape",
122 | "idiom" : "ipad",
123 | "filename" : "Default-Landscape.png",
124 | "extent" : "full-screen",
125 | "scale" : "1x"
126 | },
127 | {
128 | "orientation" : "portrait",
129 | "idiom" : "ipad",
130 | "extent" : "to-status-bar",
131 | "scale" : "2x"
132 | },
133 | {
134 | "orientation" : "portrait",
135 | "idiom" : "ipad",
136 | "filename" : "Default-Portrait@2x.png",
137 | "extent" : "full-screen",
138 | "scale" : "2x"
139 | },
140 | {
141 | "orientation" : "landscape",
142 | "idiom" : "ipad",
143 | "extent" : "to-status-bar",
144 | "scale" : "2x"
145 | },
146 | {
147 | "orientation" : "landscape",
148 | "idiom" : "ipad",
149 | "filename" : "Default-Landscape@2x.png",
150 | "extent" : "full-screen",
151 | "scale" : "2x"
152 | }
153 | ],
154 | "info" : {
155 | "version" : 1,
156 | "author" : "xcode"
157 | }
158 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-AspectFill.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-AspectFill@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-Center.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-Center@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/markosko/nativescript-hook-filter-modules/a36d120cc28c2d046007a35ed38ac5702941acee/demo/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiresFullScreen
28 |
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/build.xcconfig:
--------------------------------------------------------------------------------
1 | // You can add custom settings here
2 | // for example you can uncomment the following line to force distribution code signing
3 | // CODE_SIGN_IDENTITY = iPhone Distribution
4 | // To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID;
6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
8 |
--------------------------------------------------------------------------------
/demo/app/app.css:
--------------------------------------------------------------------------------
1 | .title {
2 | font-size: 30;
3 | horizontal-align: center;
4 | margin: 20;
5 | }
6 |
7 | button {
8 | font-size: 42;
9 | horizontal-align: center;
10 | }
11 |
12 | .message {
13 | font-size: 20;
14 | color: #284848;
15 | horizontal-align: center;
16 | margin: 0 20;
17 | text-align: center;
18 | }
19 |
--------------------------------------------------------------------------------
/demo/app/app.js:
--------------------------------------------------------------------------------
1 | var application = require("application");
2 | application.start({ moduleName: "main-page" });
3 |
--------------------------------------------------------------------------------
/demo/app/main-page.js:
--------------------------------------------------------------------------------
1 | var createViewModel = require("./main-view-model").createViewModel;
2 |
3 | function onNavigatingTo(args) {
4 | var page = args.object;
5 | page.bindingContext = createViewModel();
6 | }
7 | exports.onNavigatingTo = onNavigatingTo;
--------------------------------------------------------------------------------
/demo/app/main-page.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/demo/app/main-view-model.js:
--------------------------------------------------------------------------------
1 | var Observable = require("data/observable").Observable;
2 |
3 | function getMessage(counter) {
4 | if (counter <= 0) {
5 | return "Hoorraaay! You unlocked the NativeScript clicker achievement!";
6 | } else {
7 | return counter + " taps left";
8 | }
9 | }
10 |
11 | function createViewModel() {
12 | var viewModel = new Observable();
13 | viewModel.counter = 42;
14 | viewModel.message = getMessage(viewModel.counter);
15 |
16 | viewModel.onTap = function() {
17 | this.counter--;
18 | this.set("message", getMessage(this.counter));
19 | }
20 |
21 | return viewModel;
22 | }
23 |
24 | exports.createViewModel = createViewModel;
--------------------------------------------------------------------------------
/demo/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tns-template-hello-world",
3 | "main": "app.js",
4 | "version": "2.3.0",
5 | "author": "Telerik ",
6 | "description": "Nativescript hello-world project template",
7 | "license": "Apache-2.0",
8 | "keywords": [
9 | "telerik",
10 | "mobile",
11 | "nativescript",
12 | "{N}",
13 | "tns",
14 | "appbuilder",
15 | "template"
16 | ],
17 | "repository": {
18 | "type": "git",
19 | "url": "git://github.com/NativeScript/template-hello-world.git"
20 | },
21 | "bugs": {
22 | "url": "https://github.com/NativeScript/template-hello-world/issues"
23 | },
24 | "homepage": "https://github.com/NativeScript/template-hello-world",
25 | "android": {
26 | "v8Flags": "--expose_gc"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/demo/app/references.d.ts:
--------------------------------------------------------------------------------
1 | /// Enable smart suggestions and completions in Visual Studio Code JavaScript projects.
2 |
--------------------------------------------------------------------------------
/demo/filter-modules.json:
--------------------------------------------------------------------------------
1 | {
2 | "to_be_deleted": [
3 | ],
4 | "to_be_kept": [
5 |
6 | ]
7 | }
--------------------------------------------------------------------------------
/demo/hooks/after-prepare/nativescript-hook-filter-modules.js:
--------------------------------------------------------------------------------
1 | module.exports = require("nativescript-hook-filter-modules/after-prepare-hook.js");
2 |
--------------------------------------------------------------------------------
/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "NativeScript Application",
3 | "license": "SEE LICENSE IN ",
4 | "readme": "NativeScript Application",
5 | "repository": "",
6 | "nativescript": {
7 | "id": "org.nativescript.demo",
8 | "tns-android": {
9 | "version": "2.3.0"
10 | }
11 | },
12 | "dependencies": {
13 | "nativescript-hook-filter-modules": "file:..",
14 | "tns-core-modules": "2.3.0"
15 | },
16 | "devDependencies": {
17 | "babel-traverse": "6.16.0",
18 | "babel-types": "6.16.0",
19 | "babylon": "6.11.2",
20 | "lazy": "1.0.11"
21 | }
22 | }
--------------------------------------------------------------------------------
/filter-modules.json.template:
--------------------------------------------------------------------------------
1 | {
2 | "to_be_deleted":[
3 |
4 | ],
5 | "to_be_kept":[
6 |
7 | ]
8 | }
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 |
2 | var path = require("path");
3 | var fs = require("fs");
4 |
5 | var tnsPackage = "tns-core-modules";
6 | var tnsModulesDir = path.join("node_modules", tnsPackage);
7 |
8 | var platform = process.env.PLATFORM;
9 | var platformOutDir = process.env.PLATFORM_DIR;
10 | /*
11 | exports.readPackageJson = resolver.readPackageJson;
12 | exports.getPackageMain = resolver.getPackageMain;
13 |
14 | exports.writePackageJson = function writePackageJson(dir, data) {
15 | var packageJson = path.join(dir, "package.json");
16 | fs.writeFileSync(packageJson, JSON.stringify(data, null, 4), 'utf8');
17 | };
18 | */
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativescript-hook-filter-modules",
3 | "version": "1.0.5",
4 | "description": "Shrinking size of built application by deleting defined set of node_modules inside tns_modules",
5 | "main": "index.js",
6 | "nativescript": {
7 | "hooks": [
8 | {
9 | "type": "after-prepare",
10 | "script": "after-prepare-hook.js",
11 | "inject": true
12 | }
13 | ]
14 | },
15 | "repository": {
16 | "type": "git",
17 | "url": "https://github.com/markosko/nativescript-hook-filter-modules.git"
18 | },
19 | "keywords": [
20 | "NativeScript",
21 | "nativescript-hook-filter-modules",
22 | "nativescript",
23 | "nativescript-hook",
24 | "shrinking"
25 | ],
26 | "author": {
27 | "name": "Marek Maszay",
28 | "email": "markosko.mm@gmail.com",
29 | "url": "https://github.com/markosko"
30 | },
31 | "contributors": [
32 | {
33 | "name": "Brad Martin",
34 | "email": "bradwaynemartin@gmail.com",
35 | "url": "https://github.com/bradmartin"
36 | }
37 | ],
38 | "license": {
39 | "type": "MIT",
40 | "url": "https://github.com/markosko/nativescript-hook-filter-modules/blob/master/LICENSE"
41 | },
42 | "bugs": {
43 | "url": "https://github.com/markosko/nativescript-hook-filter-modules/issues"
44 | },
45 | "homepage": "https://github.com/markosko/nativescript-hook-filter-modules",
46 | "readmeFilename": "README.md",
47 | "scripts": {
48 | "demo.ios": "npm run preparedemo && cd demo && tns emulate ios",
49 | "demo.android": "npm run preparedemo && cd demo && tns run android",
50 | "debug.ios": "npm run preparedemo && cd demo && tns debug ios --emulator",
51 | "debug.android": "npm run preparedemo && cd demo && tns debug android --emulator",
52 | "preparedemo": "cd demo && tns plugin remove nativescript-hook-filter-modules && tns plugin add .. && tns install",
53 | "setup": "cd demo && npm install && tns plugin add .. && cd ..",
54 | "start": "npm run demo.android",
55 | "postinstall": "node postinstall.js",
56 | "preuninstall": "node preuninstall.js"
57 | },
58 | "dependencies": {
59 | "find-remove": "^1.0.0",
60 | "nativescript-hook": "^0.2.1",
61 | "shelljs": "^0.7.4"
62 | }
63 | }
--------------------------------------------------------------------------------
/postinstall.js:
--------------------------------------------------------------------------------
1 | var hook = require('nativescript-hook')(__dirname);
2 | hook.postinstall();
3 |
4 | var path = require("path");
5 | var fs = require("fs");
6 |
7 | var projectDir = hook.findProjectDir();
8 | var appDir = path.join(projectDir, "app");
9 |
10 | // Create a webpack.config.js file, if not present.
11 | var configTemplatePath = path.join(__dirname, "filter-modules.json.template");
12 | var configPath = path.join(projectDir, "filter-modules.json");
13 | if (!fs.existsSync(configPath)) {
14 | var configContent = fs.readFileSync(configTemplatePath, "utf8");
15 | fs.writeFileSync(configPath, configContent);
16 | }
17 |
--------------------------------------------------------------------------------
/preuninstall.js:
--------------------------------------------------------------------------------
1 | var hook = require('nativescript-hook')(__dirname);
2 | hook.preuninstall();
--------------------------------------------------------------------------------