feat(android): background color/image handling improvements (#10451)

This commit is contained in:
Dimitris-Rafail Katsampas
2024-06-29 01:07:10 +03:00
committed by GitHub
parent bb83addb5c
commit 4abcb216da
38 changed files with 321 additions and 339 deletions

View File

@@ -58,7 +58,7 @@ describe('base configuration', () => {
'__jest__/tsconfig.app.json', // ts-loader
'__jest__/tsconfig.app.json', // fork-ts-checker
]);
}
},
);
});
@@ -97,7 +97,7 @@ describe('base configuration', () => {
'__jest__/tsconfig.json', // ts-loader
'__jest__/tsconfig.json', // fork-ts-checker
]);
}
},
);
});
@@ -126,7 +126,7 @@ describe('base configuration', () => {
expect(args[0].path).toEqual('__jest__/.env');
return args;
});
}
},
);
fsSpy.mockRestore();
@@ -151,7 +151,7 @@ describe('base configuration', () => {
expect(args[0].path).toEqual('__jest__/.env.prod');
return args;
});
}
},
);
fsSpy.mockRestore();
});
@@ -176,7 +176,7 @@ describe('base configuration', () => {
expect(args[0].path).toEqual('__jest__/.env');
return args;
});
}
},
);
fsSpy.mockRestore();
});
@@ -226,7 +226,7 @@ describe('base configuration', () => {
it('includes inspector_modules on android when @nativescript/core version is >= 8.7.0', () => {
const getDependencyVersionSpy = jest.spyOn(
dependenciesHelpers,
'getDependencyVersion'
'getDependencyVersion',
);
getDependencyVersionSpy.withImplementation(
(name) => {
@@ -245,7 +245,7 @@ describe('base configuration', () => {
expect(entry).toBeDefined();
expect(entry.values().length).toBe(1);
}
},
);
});
});

View File

@@ -11,7 +11,7 @@ import { parseEnvFlags } from '../cli/parseEnvFlags';
const defaultConfig = path.resolve(
__dirname,
'../stubs/default.config.stub.js'
'../stubs/default.config.stub.js',
);
const tag = `[${green('@nativescript/webpack')}]`;
@@ -91,7 +91,7 @@ program
const webpackCompilationCallback = (
err: webpack.WebpackError,
stats: webpack.Stats
stats: webpack.Stats,
) => {
if (err) {
// Do not keep cache anymore
@@ -116,7 +116,7 @@ program
chunks: false,
colors: true,
errorDetails: env.verbose,
})
}),
);
}
@@ -127,18 +127,18 @@ program
'',
'|',
`| The build profile has been written to ${yellow(
'webpack.stats.json'
'webpack.stats.json',
)}`,
`| You can analyse the stats at ${green(
'https://webpack.github.io/analyse/'
'https://webpack.github.io/analyse/',
)}`,
'|',
'',
].join('\n')
].join('\n'),
);
fs.writeFileSync(
path.join(process.cwd(), 'webpack.stats.json'),
JSON.stringify(stats.toJson())
JSON.stringify(stats.toJson()),
);
}
}
@@ -148,15 +148,15 @@ program
env.stats && console.log('webpack is watching the files...');
compiler.watch(
configuration.watchOptions ?? {},
webpackCompilationCallback
webpackCompilationCallback,
);
} else {
compiler.run((err, status) => {
compiler.close((err2) =>
webpackCompilationCallback(
(err || err2) as webpack.WebpackError,
status
)
status,
),
);
});
}

View File

@@ -161,11 +161,11 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
}
if (this.pluginOptions.jitMode) {
transformers.before.unshift(
require('../transformers/NativeClass').default
require('../transformers/NativeClass').default,
);
} else {
transformers.before.push(
require('../transformers/NativeClass').default
require('../transformers/NativeClass').default,
);
}
args[1] = transformers;
@@ -189,7 +189,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
});
const buildAngularVersion = getDependencyVersion(
'@angular-devkit/build-angular'
'@angular-devkit/build-angular',
);
if (buildAngularVersion) {
@@ -212,7 +212,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
.rule('angular-webpack-loader')
.test(/\.[cm]?[tj]sx?$/)
.exclude.add(
/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\]/
/[/\\](?:core-js|@babel|tslib|web-animations-js|web-streams-polyfill)[/\\]/,
)
.end()
.resolve.set('fullySpecified', false)
@@ -226,7 +226,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
'build-angular-missing',
`
@angular-devkit/build-angular is missing! Some features may not work as expected. Please install it manually to get rid of this warning.
`
`,
);
}
}
@@ -281,7 +281,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
},
/core\/profiling/,
/core\/ui\/styling/,
])
]),
);
config.optimization.minimizer('TerserPlugin').tap((args) => {
@@ -330,10 +330,10 @@ function tryRequireResolve(path: string) {
function getWebpackLoaderPath() {
return (
tryRequireResolve(
'@angular-devkit/build-angular/src/babel/webpack-loader'
'@angular-devkit/build-angular/src/babel/webpack-loader',
) ??
tryRequireResolve(
'@angular-devkit/build-angular/src/tools/babel/webpack-loader'
'@angular-devkit/build-angular/src/tools/babel/webpack-loader',
) ??
// fallback to angular 16.1+
'@angular-devkit/build-angular/src/tools/babel/webpack-loader'

View File

@@ -87,7 +87,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
const sourceMapAbsolutePath = getProjectFilePath(
`./${
env.buildPath ?? 'platforms'
}/${platform}-sourceMaps/[file].map[query]`
}/${platform}-sourceMaps/[file].map[query]`,
);
const sourceMapRelativePath = relative(outputPath, sourceMapAbsolutePath);
config.output.sourceMapFilename(sourceMapRelativePath);
@@ -273,7 +273,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
const configFile = tsConfigPath
? {
configFile: tsConfigPath,
}
}
: undefined;
// set up ts support
@@ -452,7 +452,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
* +-----------------------------------------------------------------------------------------+
*/
/System.import\(\) is deprecated/,
])
]),
);
// todo: refine defaults

View File

@@ -89,7 +89,7 @@ export function getPlatformName(): Platform {
Use --env.platform=<platform> or --env.android, --env.ios, --env.visionos to specify the target platform.
Defaulting to "ios".
`
`,
);
return 'ios';