@openedx/frontend-base 1.0.0-alpha.39 → 1.0.0-alpha.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shell/layer-order.scss +1 -0
- package/dist/shell/style.scss +0 -2
- package/dist/tools/webpack/common-config/all/getStylesheetRule.d.ts +10 -0
- package/dist/tools/webpack/common-config/all/getStylesheetRule.js +10 -8
- package/dist/tools/webpack/common-config/site/getHtmlWebpackPlugin.js +11 -3
- package/dist/tools/webpack/webpack.config.build.js +1 -0
- package/dist/tools/webpack/webpack.config.dev.js +1 -0
- package/dist/tools/webpack/webpack.config.dev.shell.js +4 -2
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer paragon, shell, app, site, brand;
|
package/dist/shell/style.scss
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import { RuleSetRule } from 'webpack';
|
|
2
|
+
export declare const PARAGON_PACKAGE: {
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const SHELL_PACKAGE: {
|
|
6
|
+
name: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const BRAND_PACKAGE: {
|
|
9
|
+
name: RegExp;
|
|
10
|
+
};
|
|
11
|
+
export declare const APP_RESOURCE: RegExp;
|
|
2
12
|
export default function getStylesheetRule(mode: 'dev' | 'production'): RuleSetRule;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.APP_RESOURCE = exports.BRAND_PACKAGE = exports.SHELL_PACKAGE = exports.PARAGON_PACKAGE = void 0;
|
|
6
7
|
exports.default = getStylesheetRule;
|
|
7
8
|
const autoprefixer_1 = __importDefault(require("autoprefixer"));
|
|
8
9
|
const cssnano_1 = __importDefault(require("cssnano"));
|
|
@@ -25,10 +26,11 @@ const postcssWrapLayer_1 = __importDefault(require("./postcssWrapLayer"));
|
|
|
25
26
|
* precedence of runtime brand CSS (which is injected unlayered via
|
|
26
27
|
* <link> tags and thus beats every layered rule).
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
exports.PARAGON_PACKAGE = { name: '@openedx/paragon' };
|
|
30
|
+
exports.SHELL_PACKAGE = { name: '@openedx/frontend-base' };
|
|
31
|
+
exports.BRAND_PACKAGE = { name: /^@(open)?edx\/brand(-.+)?$/ };
|
|
32
|
+
// The site/app split is positional (my project vs. a dep), so it is path-based.
|
|
33
|
+
exports.APP_RESOURCE = /[\\/](node_modules|packages)[\\/]/;
|
|
32
34
|
/*
|
|
33
35
|
* There are a few things we need to do here.
|
|
34
36
|
*
|
|
@@ -43,7 +45,7 @@ function getStylesheetRule(mode) {
|
|
|
43
45
|
test: /(.scss|.css)$/,
|
|
44
46
|
oneOf: [
|
|
45
47
|
{
|
|
46
|
-
|
|
48
|
+
descriptionData: exports.PARAGON_PACKAGE,
|
|
47
49
|
// We need Paragon to not elide CSS: we have to be able to import it
|
|
48
50
|
// directly from shell/style.ts
|
|
49
51
|
sideEffects: true,
|
|
@@ -53,21 +55,21 @@ function getStylesheetRule(mode) {
|
|
|
53
55
|
],
|
|
54
56
|
},
|
|
55
57
|
{
|
|
56
|
-
|
|
58
|
+
descriptionData: exports.SHELL_PACKAGE,
|
|
57
59
|
use: [
|
|
58
60
|
mini_css_extract_plugin_1.default.loader,
|
|
59
61
|
...getStyleUseConfig(mode, 'shell'),
|
|
60
62
|
],
|
|
61
63
|
},
|
|
62
64
|
{
|
|
63
|
-
|
|
65
|
+
descriptionData: exports.BRAND_PACKAGE,
|
|
64
66
|
use: [
|
|
65
67
|
mini_css_extract_plugin_1.default.loader,
|
|
66
68
|
...getStyleUseConfig(mode, 'brand'),
|
|
67
69
|
],
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
|
-
resource: { not: [
|
|
72
|
+
resource: { not: [exports.APP_RESOURCE] },
|
|
71
73
|
use: [
|
|
72
74
|
getFirstLoader(mode),
|
|
73
75
|
...getStyleUseConfig(mode, 'site'),
|
|
@@ -6,11 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.default = getHtmlWebpackPlugin;
|
|
7
7
|
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
|
|
9
|
+
/*
|
|
10
|
+
* Generates an HTML file in the output directory.
|
|
11
|
+
*
|
|
12
|
+
* `cssLayerOrder` is listed first so its <link> is injected before any other
|
|
13
|
+
* stylesheet. That file contains the `@layer paragon, shell, app, site, brand;`
|
|
14
|
+
* statement, which locks in cascade-layer priority before any layer name is
|
|
15
|
+
* mentioned by the rest of the CSS the browser parses.
|
|
16
|
+
*/
|
|
10
17
|
function getHtmlWebpackPlugin() {
|
|
11
18
|
return new html_webpack_plugin_1.default({
|
|
12
|
-
inject: true,
|
|
19
|
+
inject: true,
|
|
13
20
|
template: path_1.default.resolve(process.cwd(), 'public/index.html'),
|
|
14
|
-
chunks: ['app'],
|
|
21
|
+
chunks: ['cssLayerOrder', 'app'],
|
|
22
|
+
chunksSortMode: 'manual',
|
|
15
23
|
});
|
|
16
24
|
}
|
|
@@ -17,6 +17,7 @@ const resolvedSiteConfigPath = (0, getResolvedSiteConfigPath_1.default)('site.co
|
|
|
17
17
|
const resolvedSiteI18nPath = (0, getResolvedSiteI18nPath_1.default)('src/i18n');
|
|
18
18
|
const config = {
|
|
19
19
|
entry: {
|
|
20
|
+
cssLayerOrder: '@openedx/frontend-base/shell/layer-order.scss',
|
|
20
21
|
app: '@openedx/frontend-base/shell/site',
|
|
21
22
|
},
|
|
22
23
|
output: {
|
|
@@ -19,6 +19,7 @@ const resolvedSiteConfigPath = (0, getResolvedSiteConfigPath_1.default)('shell/s
|
|
|
19
19
|
const resolvedSiteI18nPath = (0, getResolvedSiteI18nPath_1.default)('test-site/src/i18n');
|
|
20
20
|
const config = {
|
|
21
21
|
entry: {
|
|
22
|
+
cssLayerOrder: path_1.default.resolve(process.cwd(), 'shell/layer-order.scss'),
|
|
22
23
|
app: path_1.default.resolve(process.cwd(), 'shell/site'),
|
|
23
24
|
},
|
|
24
25
|
output: {
|
|
@@ -85,9 +86,10 @@ const config = {
|
|
|
85
86
|
filename: '[name].css',
|
|
86
87
|
}),
|
|
87
88
|
new html_webpack_plugin_1.default({
|
|
88
|
-
inject: true,
|
|
89
|
+
inject: true,
|
|
89
90
|
template: path_1.default.resolve(process.cwd(), 'shell/public/index.html'),
|
|
90
|
-
chunks: ['app'],
|
|
91
|
+
chunks: ['cssLayerOrder', 'app'],
|
|
92
|
+
chunksSortMode: 'manual',
|
|
91
93
|
}),
|
|
92
94
|
new react_refresh_webpack_plugin_1.default(),
|
|
93
95
|
new fork_ts_checker_webpack_plugin_1.default(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openedx/frontend-base",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.40",
|
|
4
4
|
"description": "Build tools, setup and config for frontend apps",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
".": "./dist/index.js",
|
|
10
10
|
"./tools": "./dist/tools/index.js",
|
|
11
11
|
"./tools/tsconfig.json": "./dist/tools/typescript/tsconfig.json",
|
|
12
|
+
"./shell/layer-order.scss": "./dist/shell/layer-order.scss",
|
|
12
13
|
"./shell/style": "./dist/shell/style.js",
|
|
13
14
|
"./shell/site": "./dist/shell/site.js"
|
|
14
15
|
},
|