Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,21 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
});
});
}

it('uses a provided file with a single quote in its path', async () => {
await harness.writeFile('src/main.ts', 'console.log("TEST");');
await harness.writeFile(`src/dev's polyfills/polyfills.js`, `console.log('main');`);

harness.useTarget('build', {
...BASE_OPTIONS,
polyfills: [`src/dev's polyfills/polyfills.js`],
});

const { result } = await harness.executeOnce();

expect(result?.success).toBe(true);

harness.expectFile('dist/browser/polyfills.js').content.toContain(`console.log("main")`);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
.content.toContain('<link rel="stylesheet" href="styles.css">');
});

it('processes a style with a single quote in its path', async () => {
await harness.writeFile(`src/dev's theme/test-style-a.css`, '.test-a {color: red}');

harness.useTarget('build', {
...BASE_OPTIONS,
styles: [`src/dev's theme/test-style-a.css`],
});

const { result } = await harness.executeOnce();

expect(result?.success).toBe(true);

harness
.expectFile('dist/browser/styles.css')
.content.toMatch(/\.test-a {\s*color: red;?\s*}/);
});

it('processes multiple styles into a single output', async () => {
await harness.writeFiles({
'src/test-style-a.css': '.test-a {color: red}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ export function createServerMainCodeBundleOptions(
`export { ɵresetCompiledComponents } from '@angular/core';`,

// Re-export all symbols including default export from 'main.server.ts'
`export { default } from '${mainServerEntryPointJsImport}';`,
`export * from '${mainServerEntryPointJsImport}';`,
`export { default } from ${JSON.stringify(mainServerEntryPointJsImport)};`,
`export * from ${JSON.stringify(mainServerEntryPointJsImport)};`,
];

return {
Expand Down Expand Up @@ -496,8 +496,8 @@ export function createSsrEntryCodeBundleOptions(
`import '${ssrInjectManifestNamespace}';`,

// Re-export all symbols including default export
`import * as server from '${serverEntryPointJsImport}';`,
`export * from '${serverEntryPointJsImport}';`,
`import * as server from ${JSON.stringify(serverEntryPointJsImport)};`,
`export * from ${JSON.stringify(serverEntryPointJsImport)};`,
// The below is needed to avoid
// `Import "default" will always be undefined because there is no matching export` warning when no default is present.
`const defaultExportName = 'default';`,
Expand Down Expand Up @@ -740,7 +740,9 @@ function getEsBuildCommonPolyfillsOptions(
}

// Generate module contents with an import statement per defined polyfill
let contents = polyfillPaths.map((file) => `import '${toPosixPath(file)}';`).join('\n');
let contents = polyfillPaths
.map((file) => `import ${JSON.stringify(toPosixPath(file))};`)
Comment thread
alan-agius4 marked this conversation as resolved.
.join('\n');

// The below should be done after loading `$localize` as otherwise the locale will be overridden.
if (i18nOptions.shouldInline) {
Expand Down
4 changes: 3 additions & 1 deletion packages/angular/build/src/tools/esbuild/global-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export function createGlobalStylesBundleOptions(
assert(files, `global style name should always be found [${args.path}]`);

return {
contents: files.map((file) => `@import '${toPosixPath(file)}';`).join('\n'),
contents: files
.map((file) => `@import ${JSON.stringify(toPosixPath(file))};`)
.join('\n'),
loader: 'css',
resolveDir: workspaceRoot,
};
Expand Down
Loading