Merge branch 'master' into feat/webpack5-polyfills

This commit is contained in:
Nathan Walker
2021-12-21 18:27:39 -08:00
committed by GitHub
98 changed files with 1465 additions and 1232 deletions

View File

@@ -84,23 +84,9 @@ exports[`angular configuration for android 1`] = `
options: {
platform: 'android'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
}
]
},
/* config.module.rule('js') */
{
test: /\\\\.js$/,
exclude: [
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
@@ -111,6 +97,13 @@ exports[`angular configuration for android 1`] = `
}
]
},
/* config.module.rule('js') */
{
test: /\\\\.js$/,
exclude: [
/node_modules/
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -144,7 +137,12 @@ exports[`angular configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -174,7 +172,12 @@ exports[`angular configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -185,6 +188,26 @@ exports[`angular configuration for android 1`] = `
}
]
},
/* config.module.rule('angular-webpack-loader') */
{
test: /\\\\.[cm]?[tj]sx?$/,
exclude: [
/[/\\\\\\\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\\\\\\\]/
],
use: [
/* config.module.rule('angular-webpack-loader').use('webpack-loader') */
{
loader: '@angular-devkit/build-angular/src/babel/webpack-loader',
options: {
scriptTarget: 99,
aot: true
}
}
],
resolve: {
fullySpecified: false
}
},
/* config.module.rule('angular') */
{
test: /(?:\\\\.ngfactory.js|\\\\.ngstyle\\\\.js|\\\\.ts)$/,
@@ -246,7 +269,12 @@ exports[`angular configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -378,8 +406,8 @@ exports[`angular configuration for android 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity'
@@ -472,23 +500,9 @@ exports[`angular configuration for ios 1`] = `
options: {
platform: 'ios'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
}
]
},
/* config.module.rule('js') */
{
test: /\\\\.js$/,
exclude: [
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
@@ -499,6 +513,13 @@ exports[`angular configuration for ios 1`] = `
}
]
},
/* config.module.rule('js') */
{
test: /\\\\.js$/,
exclude: [
/node_modules/
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -532,7 +553,12 @@ exports[`angular configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -562,7 +588,12 @@ exports[`angular configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -573,6 +604,26 @@ exports[`angular configuration for ios 1`] = `
}
]
},
/* config.module.rule('angular-webpack-loader') */
{
test: /\\\\.[cm]?[tj]sx?$/,
exclude: [
/[/\\\\\\\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\\\\\\\]/
],
use: [
/* config.module.rule('angular-webpack-loader').use('webpack-loader') */
{
loader: '@angular-devkit/build-angular/src/babel/webpack-loader',
options: {
scriptTarget: 99,
aot: true
}
}
],
resolve: {
fullySpecified: false
}
},
/* config.module.rule('angular') */
{
test: /(?:\\\\.ngfactory.js|\\\\.ngstyle\\\\.js|\\\\.ts)$/,
@@ -634,7 +685,12 @@ exports[`angular configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -766,8 +822,8 @@ exports[`angular configuration for ios 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [
@@ -780,7 +836,7 @@ exports[`angular configuration for ios 1`] = `
exports[`angular configuration loads polyfills.android.ts into the bundle entry if it exists 1`] = `
Array [
"__jest__/src/polyfills.android.ts",
"@nativescript/core/bundle-entry-points.js",
"@nativescript/core/bundle-entry-points",
"__jest__/src/app.js",
"@nativescript/core/ui/frame",
"@nativescript/core/ui/frame/activity",
@@ -790,7 +846,7 @@ Array [
exports[`angular configuration loads polyfills.ios.ts into the bundle entry if it exists 1`] = `
Array [
"__jest__/src/polyfills.ios.ts",
"@nativescript/core/bundle-entry-points.js",
"@nativescript/core/bundle-entry-points",
"__jest__/src/app.js",
]
`;
@@ -798,7 +854,7 @@ Array [
exports[`angular configuration loads polyfills.ts into the bundle entry if it exists 1`] = `
Array [
"__jest__/src/polyfills.ts",
"@nativescript/core/bundle-entry-points.js",
"@nativescript/core/bundle-entry-points",
"__jest__/src/app.js",
]
`;

View File

@@ -72,13 +72,16 @@ exports[`base configuration for android 1`] = `
options: {
platform: 'android'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -110,16 +113,6 @@ exports[`base configuration for android 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -148,7 +141,12 @@ exports[`base configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -173,7 +171,12 @@ exports[`base configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -301,8 +304,8 @@ exports[`base configuration for android 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity'
@@ -383,13 +386,16 @@ exports[`base configuration for ios 1`] = `
options: {
platform: 'ios'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -421,16 +427,6 @@ exports[`base configuration for ios 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -459,7 +455,12 @@ exports[`base configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -484,7 +485,12 @@ exports[`base configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -612,8 +618,8 @@ exports[`base configuration for ios 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [

View File

@@ -72,13 +72,16 @@ exports[`javascript configuration for android 1`] = `
options: {
platform: 'android'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -110,16 +113,6 @@ exports[`javascript configuration for android 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -148,7 +141,12 @@ exports[`javascript configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -173,7 +171,12 @@ exports[`javascript configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -183,23 +186,6 @@ exports[`javascript configuration for android 1`] = `
loader: 'sass-loader'
}
]
},
/* config.module.rule('hmr-core') */
{
test: /\\\\.js$/,
exclude: [
/node_modules/,
'__jest__/src/app.js'
],
use: [
/* config.module.rule('hmr-core').use('nativescript-hot-loader') */
{
loader: 'nativescript-hot-loader',
options: {
appPath: '__jest__/src'
}
}
]
}
]
},
@@ -326,9 +312,9 @@ exports[`javascript configuration for android 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/globals/index',
'__jest__/src/__@nativescript_webpack_virtual_entry_javascript__',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity'
@@ -409,13 +395,16 @@ exports[`javascript configuration for ios 1`] = `
options: {
platform: 'ios'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -447,16 +436,6 @@ exports[`javascript configuration for ios 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -485,7 +464,12 @@ exports[`javascript configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -510,7 +494,12 @@ exports[`javascript configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -520,23 +509,6 @@ exports[`javascript configuration for ios 1`] = `
loader: 'sass-loader'
}
]
},
/* config.module.rule('hmr-core') */
{
test: /\\\\.js$/,
exclude: [
/node_modules/,
'__jest__/src/app.js'
],
use: [
/* config.module.rule('hmr-core').use('nativescript-hot-loader') */
{
loader: 'nativescript-hot-loader',
options: {
appPath: '__jest__/src'
}
}
]
}
]
},
@@ -663,9 +635,9 @@ exports[`javascript configuration for ios 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/globals/index',
'__jest__/src/__@nativescript_webpack_virtual_entry_javascript__',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [

View File

@@ -85,6 +85,16 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('ts') */
{
test: [
@@ -125,16 +135,6 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -163,7 +163,12 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -188,7 +193,12 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -317,14 +327,14 @@ exports[`react configuration > android > adds ReactRefreshWebpackPlugin when HMR
overlay: false,
forceEnable: false,
exclude: /node_modules/i,
include: /\\\\.([jt]sx?|flow)$/i
include: /\\\\.([cm]js|[jt]sx?|flow)$/i
}
)
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity'
@@ -408,13 +418,16 @@ exports[`react configuration > android > base config 1`] = `
options: {
platform: 'android'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -447,16 +460,6 @@ exports[`react configuration > android > base config 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -485,7 +488,12 @@ exports[`react configuration > android > base config 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -510,7 +518,12 @@ exports[`react configuration > android > base config 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -634,8 +647,8 @@ exports[`react configuration > android > base config 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity'
@@ -729,6 +742,16 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('ts') */
{
test: [
@@ -769,16 +792,6 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -807,7 +820,12 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -832,7 +850,12 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -961,14 +984,14 @@ exports[`react configuration > ios > adds ReactRefreshWebpackPlugin when HMR ena
overlay: false,
forceEnable: false,
exclude: /node_modules/i,
include: /\\\\.([jt]sx?|flow)$/i
include: /\\\\.([cm]js|[jt]sx?|flow)$/i
}
)
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [
@@ -1053,13 +1076,16 @@ exports[`react configuration > ios > base config 1`] = `
options: {
platform: 'ios'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -1092,16 +1118,6 @@ exports[`react configuration > ios > base config 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -1130,7 +1146,12 @@ exports[`react configuration > ios > base config 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -1155,7 +1176,12 @@ exports[`react configuration > ios > base config 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -1279,8 +1305,8 @@ exports[`react configuration > ios > base config 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [

View File

@@ -34,6 +34,7 @@ exports[`svelte configuration for android 1`] = `
alias: {
'~': '__jest__/src',
'@': '__jest__/src',
svelte$: 'svelte/internal',
'tns-core-modules': '@nativescript/core'
},
extensions: [
@@ -75,13 +76,16 @@ exports[`svelte configuration for android 1`] = `
options: {
platform: 'android'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts|svelte)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -113,16 +117,6 @@ exports[`svelte configuration for android 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts|svelte)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -151,7 +145,12 @@ exports[`svelte configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -176,7 +175,12 @@ exports[`svelte configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -321,8 +325,8 @@ exports[`svelte configuration for android 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity'
@@ -365,6 +369,7 @@ exports[`svelte configuration for ios 1`] = `
alias: {
'~': '__jest__/src',
'@': '__jest__/src',
svelte$: 'svelte/internal',
'tns-core-modules': '@nativescript/core'
},
extensions: [
@@ -406,13 +411,16 @@ exports[`svelte configuration for ios 1`] = `
options: {
platform: 'ios'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts|svelte)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -444,16 +452,6 @@ exports[`svelte configuration for ios 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts|svelte)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -482,7 +480,12 @@ exports[`svelte configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -507,7 +510,12 @@ exports[`svelte configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -652,8 +660,8 @@ exports[`svelte configuration for ios 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [

View File

@@ -72,13 +72,16 @@ exports[`typescript configuration for android 1`] = `
options: {
platform: 'android'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -110,16 +113,6 @@ exports[`typescript configuration for android 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -148,7 +141,12 @@ exports[`typescript configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -173,7 +171,12 @@ exports[`typescript configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -183,23 +186,6 @@ exports[`typescript configuration for android 1`] = `
loader: 'sass-loader'
}
]
},
/* config.module.rule('hmr-core') */
{
test: /\\\\.(js|ts)$/,
exclude: [
/node_modules/,
'__jest__/src/app.js'
],
use: [
/* config.module.rule('hmr-core').use('nativescript-hot-loader') */
{
loader: 'nativescript-hot-loader',
options: {
appPath: '__jest__/src'
}
}
]
}
]
},
@@ -326,9 +312,9 @@ exports[`typescript configuration for android 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/globals/index',
'__jest__/src/__@nativescript_webpack_virtual_entry_typescript__',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity'
@@ -409,13 +395,16 @@ exports[`typescript configuration for ios 1`] = `
options: {
platform: 'ios'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -447,16 +436,6 @@ exports[`typescript configuration for ios 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -485,7 +464,12 @@ exports[`typescript configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -510,7 +494,12 @@ exports[`typescript configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -520,23 +509,6 @@ exports[`typescript configuration for ios 1`] = `
loader: 'sass-loader'
}
]
},
/* config.module.rule('hmr-core') */
{
test: /\\\\.(js|ts)$/,
exclude: [
/node_modules/,
'__jest__/src/app.js'
],
use: [
/* config.module.rule('hmr-core').use('nativescript-hot-loader') */
{
loader: 'nativescript-hot-loader',
options: {
appPath: '__jest__/src'
}
}
]
}
]
},
@@ -663,9 +635,9 @@ exports[`typescript configuration for ios 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/globals/index',
'__jest__/src/__@nativescript_webpack_virtual_entry_typescript__',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [

View File

@@ -75,13 +75,16 @@ exports[`vue configuration for android 1`] = `
options: {
platform: 'android'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -116,16 +119,6 @@ exports[`vue configuration for android 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -158,7 +151,12 @@ exports[`vue configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -187,7 +185,12 @@ exports[`vue configuration for android 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -335,8 +338,8 @@ exports[`vue configuration for android 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js',
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity'
@@ -420,13 +423,16 @@ exports[`vue configuration for ios 1`] = `
options: {
platform: 'ios'
}
},
/* config.module.rule('bundle').use('nativescript-hot-loader') */
}
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-hot-loader',
options: {
injectHMRRuntime: true
}
loader: 'nativescript-worker-loader'
}
]
},
@@ -461,16 +467,6 @@ exports[`vue configuration for ios 1`] = `
/node_modules/
]
},
/* config.module.rule('workers') */
{
test: /\\\\.(js|ts)$/,
use: [
/* config.module.rule('workers').use('nativescript-worker-loader') */
{
loader: 'nativescript-worker-loader'
}
]
},
/* config.module.rule('xml') */
{
test: /\\\\.xml$/,
@@ -503,7 +499,12 @@ exports[`vue configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -532,7 +533,12 @@ exports[`vue configuration for ios 1`] = `
options: {
postcssOptions: {
plugins: [
'postcss-import'
[
'postcss-import',
{
resolve: function () { /* omitted long function */ }
}
]
]
}
}
@@ -680,8 +686,8 @@ exports[`vue configuration for ios 1`] = `
],
entry: {
bundle: [
'@nativescript/core/globals/index.js',
'@nativescript/core/bundle-entry-points.js',
'@nativescript/core/globals/index',
'@nativescript/core/bundle-entry-points',
'__jest__/src/app.js'
],
'tns_modules/inspector_modules': [

View File

@@ -44,41 +44,43 @@ function getContext(
return {
rootContext: 'app',
context: 'app/component',
async: () => (error, source: string) => {
if (callbackCalled) {
done.fail('Callback called more than once!');
}
callbackCalled = true;
async() {
return (error, source: string) => {
if (callbackCalled) {
throw new Error('Callback called more than once!');
}
callbackCalled = true;
expectedDeps.forEach((expectedDep) => {
expect(actualDeps).toContain(expectedDep);
});
expectedDeps.forEach((expectedDep) => {
expect(actualDeps).toContain(expectedDep);
});
expectedRegs.forEach(({ name, path }) => {
expect(source).toContain(dedent`
expectedRegs.forEach(({ name, path }) => {
expect(source).toContain(dedent`
global.registerModule(
'${name}',
() => require("${path}")
)
`);
});
});
if (assureNoDeps) {
expect(actualDeps.length).toBe(0);
expect(source).not.toContain('global.registerModule');
}
if (assureNoDeps) {
expect(actualDeps.length).toBe(0);
expect(source).not.toContain('global.registerModule');
}
if (expectWarnings) {
expect(actualWarnings.length).toEqual(expectWarnings);
}
if (expectWarnings) {
expect(actualWarnings.length).toEqual(expectWarnings);
}
if (error && !expectError) {
done.fail(error);
} else if (!error && expectError) {
done.fail('Error expected here');
} else {
done();
}
if (error && !expectError) {
throw error;
} else if (!error && expectError) {
throw new Error('Error expected here');
} else {
done();
}
};
},
resolve: (
context: string,
@@ -272,10 +274,13 @@ describe('xml-namespace-loader', () => {
const expectedDeps = [];
const expectedRegs = [
{ name: 'nativescript-ui-chart', path: 'nativescript-ui-chart' },
{
name: 'nativescript-ui-chart',
path: 'node_modules/nativescript-ui-chart/ui-chart.js',
},
{
name: 'nativescript-ui-chart/RadCartesianChart',
path: 'nativescript-ui-chart',
path: 'node_modules/nativescript-ui-chart/ui-chart.js',
},
];
@@ -392,25 +397,16 @@ describe('xml-namespace-loader', () => {
});
it("with '&&', '||', '<=' and '>=' in binding expression, emits warnings, but does not fail", (done) => {
const resolveMap = {
'nativescript-ui-chart': 'node_modules/nativescript-ui-chart/ui-chart.js',
};
const resolveMap = {};
const expectedDeps = [];
const expectedRegs = [
{ name: 'nativescript-ui-chart', path: 'nativescript-ui-chart' },
{
name: 'nativescript-ui-chart/RadCartesianChart',
path: 'nativescript-ui-chart',
},
];
const expectedRegs = [];
const testXml = `
<Page xmlns="http://www.nativescript.org/tns.xsd">
<StackLayout xmlns:chart="nativescript-ui-chart">
<TextField text="{{ var1 && var2 || var1 >= var2 || var2 <= var1 }}" />
<chart:RadCartesianChart></chart:RadCartesianChart>
</StackLayout>
</Page>`;

View File

@@ -1,6 +1,6 @@
{
"name": "@nativescript/webpack",
"version": "5.0.0",
"version": "5.0.2-alpha.1",
"private": false,
"main": "dist/index.js",
"files": [
@@ -18,7 +18,7 @@
},
"dependencies": {
"@babel/core": "^7.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.2",
"acorn": "^8.0.0",
"acorn-stage3": "^4.0.0",
"babel-loader": "^8.0.0",
@@ -39,7 +39,7 @@
"postcss-import": "^14.0.0",
"postcss-loader": "^6.0.0",
"raw-loader": "^4.0.0",
"react-refresh": "~0.8.3",
"react-refresh": "~0.11.0",
"sass": "^1.0.0",
"sass-loader": "^12.0.0",
"sax": "^1.0.0",

View File

@@ -0,0 +1,21 @@
{
"root": "packages/webpack5",
"sourceRoot": "packages/webpack5",
"projectType": "library",
"generators": {},
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": []
}
},
"build": {
"executor": "@nrwl/workspace:run-commands",
"outputs": ["dist/packages"],
"options": {
"command": "npx zx ./tools/scripts/pack-webpack5.mjs"
}
}
}
}

View File

@@ -1,5 +1,5 @@
import { ScriptTarget } from 'typescript';
import { extname, resolve } from 'path';
import { merge } from 'webpack-merge';
import Config from 'webpack-chain';
import { existsSync } from 'fs';
@@ -148,7 +148,9 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
if (!transformers.before) {
transformers.before = [];
}
transformers.before.push(require('../transformers/NativeClass').default);
transformers.before.unshift(
require('../transformers/NativeClass').default
);
args[1] = transformers;
return originalCreateFileEmitter.apply(this, args);
};
@@ -167,6 +169,23 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
.use('angular-hot-loader')
.loader('angular-hot-loader');
});
// zone + async/await
config.module
.rule('angular-webpack-loader')
.test(/\.[cm]?[tj]sx?$/)
.exclude.add(
/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\]/
)
.end()
.resolve.set('fullySpecified', false)
.end()
.before('angular')
.use('webpack-loader')
.loader('@angular-devkit/build-angular/src/babel/webpack-loader')
.options({
scriptTarget: ScriptTarget.ESNext,
aot: true,
});
}
// look for platform specific polyfills first
@@ -182,10 +201,8 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
// replace globals with the polyfills file which
// should handle loading the correct globals
// and any additional polyfills required.
if (paths.includes('@nativescript/core/globals/index.js')) {
paths[
paths.indexOf('@nativescript/core/globals/index.js')
] = polyfillsPath;
if (paths.includes('@nativescript/core/globals/index')) {
paths[paths.indexOf('@nativescript/core/globals/index')] = polyfillsPath;
// replace paths with the updated paths
config.entry('bundle').clear().merge(paths);

View File

@@ -1,3 +1,4 @@
import { extname, resolve } from 'path';
import {
ContextExclusionPlugin,
DefinePlugin,
@@ -5,7 +6,7 @@ import {
ProvidePlugin,
} from 'webpack';
import Config from 'webpack-chain';
import { resolve } from 'path';
import { existsSync } from 'fs';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
@@ -87,8 +88,8 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
config
.entry('bundle')
// ensure we load nativescript globals first
.add('@nativescript/core/globals/index.js')
.add('@nativescript/core/bundle-entry-points.js')
.add('@nativescript/core/globals/index')
.add('@nativescript/core/bundle-entry-points')
.add(entryPath);
// Add android app components to the bundle to SBG can generate the java classes
@@ -127,6 +128,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
config.optimization.minimizer('TerserPlugin').use(TerserPlugin, [
{
terserOptions: {
// @ts-ignore - https://github.com/webpack-contrib/terser-webpack-plugin/pull/463 broke the types?
compress: {
collapse_vars: platform !== 'android',
sequences: platform !== 'android',
@@ -199,12 +201,24 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
.options({
platform,
})
.end()
.use('nativescript-hot-loader')
.loader('nativescript-hot-loader')
.options({
injectHMRRuntime: true,
});
.end();
config.when(env.hmr, (config) => {
config.module
.rule('bundle')
.use('nativescript-hot-loader')
.loader('nativescript-hot-loader')
.options({
injectHMRRuntime: true,
});
});
// worker-loader should be declared before ts-loader
config.module
.rule('workers')
.test(/\.(js|ts)$/)
.use('nativescript-worker-loader')
.loader('nativescript-worker-loader');
// set up ts support
config.module
@@ -250,12 +264,6 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
.exclude.add(/node_modules/)
.end();
config.module
.rule('workers')
.test(/\.(js|ts)$/)
.use('nativescript-worker-loader')
.loader('nativescript-worker-loader');
// config.resolve.extensions.add('.xml');
// set up xml
config.module
@@ -271,7 +279,36 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
postcssOptions: {
plugins: [
// inlines @imported stylesheets
'postcss-import',
[
'postcss-import',
{
// custom resolver to resolve platform extensions in @import statements
// ie. @import "foo.css" would import "foo.ios.css" if the platform is ios and it exists
resolve(id, baseDir, importOptions) {
const ext = extname(id);
const platformExt = ext ? `.${platform}${ext}` : '';
if (!id.includes(platformExt)) {
const platformRequest = id.replace(ext, platformExt);
const extPath = resolve(baseDir, platformRequest);
try {
return require.resolve(platformRequest, {
paths: [baseDir],
});
} catch {}
if (existsSync(extPath)) {
console.log(`resolving "${id}" to "${platformRequest}"`);
return extPath;
}
}
// fallback to postcss-import default resolution
return id;
},
},
],
],
},
};

View File

@@ -30,22 +30,25 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
chainedSetAddAfter(
config.entry('bundle'),
'@nativescript/core/globals/index.js',
'@nativescript/core/globals/index',
virtualEntryPath
);
// set up core HMR
config.module
.rule('hmr-core')
.test(/\.js$/)
.exclude.add(/node_modules/)
.add(entryPath)
.end()
.use('nativescript-hot-loader')
.loader('nativescript-hot-loader')
.options({
appPath: getEntryDirPath(),
});
config.when(env.hmr, (config) => {
// set up core HMR
config.module
.rule('hmr-core')
.before('js')
.test(/\.js$/)
.exclude.add(/node_modules/)
.add(entryPath)
.end()
.use('nativescript-hot-loader')
.loader('nativescript-hot-loader')
.options({
appPath: getEntryDirPath(),
});
});
return config;
}

View File

@@ -30,22 +30,25 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
chainedSetAddAfter(
config.entry('bundle'),
'@nativescript/core/globals/index.js',
'@nativescript/core/globals/index',
virtualEntryPath
);
// set up core HMR
config.module
.rule('hmr-core')
.test(/\.(js|ts)$/)
.exclude.add(/node_modules/)
.add(entryPath)
.end()
.use('nativescript-hot-loader')
.loader('nativescript-hot-loader')
.options({
appPath: getEntryDirPath(),
});
config.when(env.hmr, (config) => {
// set up core HMR
config.module
.rule('hmr-core')
.before('ts')
.test(/\.(js|ts)$/)
.exclude.add(/node_modules/)
.add(entryPath)
.end()
.use('nativescript-hot-loader')
.loader('nativescript-hot-loader')
.options({
appPath: getEntryDirPath(),
});
});
return config;
}

View File

@@ -78,6 +78,10 @@ async function parseXML(content: string): Promise<ParseResult> {
`${localModulePath}.xml`,
moduleName,
namespace,
`${moduleName}.xml`,
`~/${moduleName}`,
`~/${namespace}`,
`~/${moduleName}.xml`,
];
DEBUG && console.log({ resolvePaths });
let resolvedPath;
@@ -118,12 +122,13 @@ async function parseXML(content: string): Promise<ParseResult> {
this.addDependency(xml);
namespaces.push({ name: `${moduleName}.xml`, path: xml });
})
.catch(() => {
// if there is no XML file, fall back to namespace as the path
// will become require(<namespace>)
namespaces.push({ name: namespace, path: namespace });
namespaces.push({ name: moduleName, path: namespace });
});
.catch(noop);
// .catch(() => {
// // if there is no XML file, fall back to namespace as the path
// // will become require(<namespace>)
// namespaces.push({ name: namespace, path: namespace });
// namespaces.push({ name: moduleName, path: namespace });
// });
// look for css files with the same name
await resolveAsync(this.context, `${noExtFilename}.css`)
@@ -163,6 +168,8 @@ async function parseXML(content: string): Promise<ParseResult> {
distinctNamespaces.set(name, path.replace(/\\/g, '/'));
});
DEBUG && console.log({ distinctNamespaces });
distinctNamespaces.forEach((path, name) => {
moduleRegisters.push(dedent`
global.registerModule(