@expo/metro-config 0.17.2 → 0.17.4
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/build/ExpoMetroConfig.js +239 -366
- package/build/ExpoMetroConfig.js.map +1 -1
- package/build/babel-core.js +6 -23
- package/build/babel-core.js.map +1 -1
- package/build/babel-transformer.js +117 -162
- package/build/babel-transformer.js.map +1 -1
- package/build/customizeFrame.js +84 -78
- package/build/customizeFrame.js.map +1 -1
- package/build/env.js +23 -37
- package/build/env.js.map +1 -1
- package/build/file-store.js +13 -21
- package/build/file-store.js.map +1 -1
- package/build/getModulesPaths.js +31 -48
- package/build/getModulesPaths.js.map +1 -1
- package/build/getWatchFolders.js +70 -98
- package/build/getWatchFolders.js.map +1 -1
- package/build/loadBabelConfig.js +30 -49
- package/build/loadBabelConfig.js.map +1 -1
- package/build/rewriteRequestUrl.js +82 -142
- package/build/rewriteRequestUrl.js.map +1 -1
- package/build/serializer/debugId.js +23 -22
- package/build/serializer/debugId.js.map +1 -1
- package/build/serializer/environmentVariableSerializerPlugin.js +90 -101
- package/build/serializer/environmentVariableSerializerPlugin.js.map +1 -1
- package/build/serializer/exportHermes.js +96 -133
- package/build/serializer/exportHermes.js.map +1 -1
- package/build/serializer/exportPath.js +18 -35
- package/build/serializer/exportPath.js.map +1 -1
- package/build/serializer/fork/baseJSBundle.js +124 -147
- package/build/serializer/fork/baseJSBundle.js.map +1 -1
- package/build/serializer/fork/js.js +81 -116
- package/build/serializer/fork/js.js.map +1 -1
- package/build/serializer/fork/processModules.js +22 -36
- package/build/serializer/fork/processModules.js.map +1 -1
- package/build/serializer/getCssDeps.js +64 -95
- package/build/serializer/getCssDeps.js.map +1 -1
- package/build/serializer/jsOutput.js +6 -16
- package/build/serializer/jsOutput.js.map +1 -1
- package/build/serializer/serializeChunks.js +406 -483
- package/build/serializer/serializeChunks.js.map +1 -1
- package/build/serializer/serializerAssets.js +1 -0
- package/build/serializer/serializerAssets.js.map +1 -1
- package/build/serializer/withExpoSerializers.js +165 -236
- package/build/serializer/withExpoSerializers.js.map +1 -1
- package/build/transform-worker/asset-transformer.js +21 -44
- package/build/transform-worker/asset-transformer.js.map +1 -1
- package/build/transform-worker/css-modules.js +57 -84
- package/build/transform-worker/css-modules.js.map +1 -1
- package/build/transform-worker/css.js +21 -20
- package/build/transform-worker/css.js.map +1 -1
- package/build/transform-worker/getAssets.js +38 -75
- package/build/transform-worker/getAssets.js.map +1 -1
- package/build/transform-worker/metro-transform-worker.js +384 -489
- package/build/transform-worker/metro-transform-worker.js.map +1 -1
- package/build/transform-worker/postcss.js +176 -233
- package/build/transform-worker/postcss.js.map +1 -1
- package/build/transform-worker/sass.js +30 -38
- package/build/transform-worker/sass.js.map +1 -1
- package/build/transform-worker/transform-worker.js +156 -188
- package/build/transform-worker/transform-worker.js.map +1 -1
- package/build/transform-worker/utils/require.js +30 -28
- package/build/transform-worker/utils/require.js.map +1 -1
- package/build/transformSync.js +40 -28
- package/build/transformSync.js.map +1 -1
- package/build/transformer/createExoticTransformer.js +96 -129
- package/build/transformer/createExoticTransformer.js.map +1 -1
- package/build/transformer/createMatcher.js +37 -46
- package/build/transformer/createMatcher.js.map +1 -1
- package/build/transformer/createMultiRuleTransformer.js +170 -240
- package/build/transformer/createMultiRuleTransformer.js.map +1 -1
- package/build/transformer/generateFunctionMap.js +20 -23
- package/build/transformer/generateFunctionMap.js.map +1 -1
- package/build/transformer/getBabelConfig.js +94 -127
- package/build/transformer/getBabelConfig.js.map +1 -1
- package/build/transformer/getCacheKey.js +17 -31
- package/build/transformer/getCacheKey.js.map +1 -1
- package/build/transformer/index.js +11 -62
- package/build/transformer/index.js.map +1 -1
- package/build/transformer/metro-expo-exotic-babel-transformer.js +3 -12
- package/build/transformer/metro-expo-exotic-babel-transformer.js.map +1 -1
- package/build/traveling/metro-config.js +12 -19
- package/build/traveling/metro-config.js.map +1 -1
- package/build/utils/hash.js +8 -14
- package/build/utils/hash.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,42 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getJsOutput = getJsOutput;
|
|
7
|
-
exports.getModuleParams = getModuleParams;
|
|
8
|
-
exports.isJsModule = isJsModule;
|
|
9
|
-
exports.isJsOutput = isJsOutput;
|
|
10
|
-
exports.wrapModule = wrapModule;
|
|
11
|
-
function _assert() {
|
|
12
|
-
const data = _interopRequireDefault(require("assert"));
|
|
13
|
-
_assert = function () {
|
|
14
|
-
return data;
|
|
15
|
-
};
|
|
16
|
-
return data;
|
|
17
|
-
}
|
|
18
|
-
function _jscSafeUrl() {
|
|
19
|
-
const data = _interopRequireDefault(require("jsc-safe-url"));
|
|
20
|
-
_jscSafeUrl = function () {
|
|
21
|
-
return data;
|
|
22
|
-
};
|
|
23
|
-
return data;
|
|
24
|
-
}
|
|
25
|
-
function _metroTransformPlugins() {
|
|
26
|
-
const data = require("metro-transform-plugins");
|
|
27
|
-
_metroTransformPlugins = function () {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
function _path() {
|
|
33
|
-
const data = _interopRequireDefault(require("path"));
|
|
34
|
-
_path = function () {
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
40
2
|
/**
|
|
41
3
|
* Copyright © 2022 650 Industries.
|
|
42
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -47,94 +9,97 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
47
9
|
* Fork of the metro helper, but with bundle splitting support.
|
|
48
10
|
* https://github.com/facebook/metro/blob/bbdd7d7c5e6e0feb50a9967ffae1f723c1d7c4e8/packages/metro/src/DeltaBundler/Serializers/helpers/js.js#L1
|
|
49
11
|
*/
|
|
50
|
-
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.isJsOutput = exports.isJsModule = exports.getJsOutput = exports.getModuleParams = exports.wrapModule = void 0;
|
|
17
|
+
const assert_1 = __importDefault(require("assert"));
|
|
18
|
+
const jsc_safe_url_1 = __importDefault(require("jsc-safe-url"));
|
|
19
|
+
const metro_transform_plugins_1 = require("metro-transform-plugins");
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
51
21
|
function wrapModule(module, options) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
paths
|
|
62
|
-
} = getModuleParams(module, options);
|
|
63
|
-
let src = output.data.code;
|
|
64
|
-
if (!options.skipWrapping) {
|
|
65
|
-
src = (0, _metroTransformPlugins().addParamsToDefineCall)(output.data.code, ...params);
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
src,
|
|
69
|
-
paths
|
|
70
|
-
};
|
|
22
|
+
const output = getJsOutput(module);
|
|
23
|
+
if (output.type.startsWith('js/script')) {
|
|
24
|
+
return { src: output.data.code, paths: {} };
|
|
25
|
+
}
|
|
26
|
+
const { params, paths } = getModuleParams(module, options);
|
|
27
|
+
let src = output.data.code;
|
|
28
|
+
if (!options.skipWrapping) {
|
|
29
|
+
src = (0, metro_transform_plugins_1.addParamsToDefineCall)(output.data.code, ...params);
|
|
30
|
+
}
|
|
31
|
+
return { src, paths };
|
|
71
32
|
}
|
|
33
|
+
exports.wrapModule = wrapModule;
|
|
72
34
|
function getModuleParams(module, options) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
35
|
+
const moduleId = options.createModuleId(module.path);
|
|
36
|
+
const paths = {};
|
|
37
|
+
let hasPaths = false;
|
|
38
|
+
const dependencyMapArray = Array.from(module.dependencies.values()).map((dependency) => {
|
|
39
|
+
const id = options.createModuleId(dependency.absolutePath);
|
|
40
|
+
if (
|
|
41
|
+
// NOTE(EvanBacon): Disabled this to ensure that paths are provided even when the entire bundle
|
|
42
|
+
// is created. This is required for production bundle splitting.
|
|
43
|
+
// options.includeAsyncPaths &&
|
|
44
|
+
dependency.data.data.asyncType != null) {
|
|
45
|
+
if (options.includeAsyncPaths) {
|
|
46
|
+
if (options.sourceUrl) {
|
|
47
|
+
hasPaths = true;
|
|
48
|
+
// TODO: Only include path if the target is not in the bundle
|
|
49
|
+
// Construct a server-relative URL for the split bundle, propagating
|
|
50
|
+
// most parameters from the main bundle's URL.
|
|
51
|
+
const { searchParams } = new URL(jsc_safe_url_1.default.toNormalUrl(options.sourceUrl));
|
|
52
|
+
searchParams.set('modulesOnly', 'true');
|
|
53
|
+
searchParams.set('runModule', 'false');
|
|
54
|
+
const bundlePath = path_1.default.relative(options.serverRoot, dependency.absolutePath);
|
|
55
|
+
paths[id] =
|
|
56
|
+
'/' +
|
|
57
|
+
path_1.default.join(path_1.default.dirname(bundlePath),
|
|
58
|
+
// Strip the file extension
|
|
59
|
+
path_1.default.basename(bundlePath, path_1.default.extname(bundlePath))) +
|
|
60
|
+
'.bundle?' +
|
|
61
|
+
searchParams.toString();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (options.splitChunks && options.computedAsyncModulePaths != null) {
|
|
65
|
+
hasPaths = true;
|
|
66
|
+
// A template string that we'll match and replace later when we know the content hash for a given path.
|
|
67
|
+
paths[id] = options.computedAsyncModulePaths[dependency.absolutePath];
|
|
68
|
+
}
|
|
101
69
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
70
|
+
return id;
|
|
71
|
+
});
|
|
72
|
+
const params = [
|
|
73
|
+
moduleId,
|
|
74
|
+
hasPaths
|
|
75
|
+
? {
|
|
76
|
+
...dependencyMapArray,
|
|
77
|
+
paths,
|
|
78
|
+
}
|
|
79
|
+
: dependencyMapArray,
|
|
80
|
+
];
|
|
81
|
+
if (options.dev) {
|
|
82
|
+
// Add the relative path of the module to make debugging easier.
|
|
83
|
+
// This is mapped to `module.verboseName` in `require.js`.
|
|
84
|
+
params.push(path_1.default.relative(options.projectRoot, module.path));
|
|
107
85
|
}
|
|
108
|
-
return
|
|
109
|
-
});
|
|
110
|
-
const params = [moduleId, hasPaths ? {
|
|
111
|
-
...dependencyMapArray,
|
|
112
|
-
paths
|
|
113
|
-
} : dependencyMapArray];
|
|
114
|
-
if (options.dev) {
|
|
115
|
-
// Add the relative path of the module to make debugging easier.
|
|
116
|
-
// This is mapped to `module.verboseName` in `require.js`.
|
|
117
|
-
params.push(_path().default.relative(options.projectRoot, module.path));
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
params,
|
|
121
|
-
paths
|
|
122
|
-
};
|
|
86
|
+
return { params, paths };
|
|
123
87
|
}
|
|
88
|
+
exports.getModuleParams = getModuleParams;
|
|
124
89
|
function getJsOutput(module) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const jsOutput = jsModules[0];
|
|
131
|
-
(0, _assert().default)(Number.isFinite(jsOutput.data.lineCount), `JS output must populate lineCount, but ${(_module$path2 = module.path) !== null && _module$path2 !== void 0 ? _module$path2 : 'unknown module'} has ${jsOutput.type} output with lineCount '${jsOutput.data.lineCount}'`);
|
|
132
|
-
return jsOutput;
|
|
90
|
+
const jsModules = module.output.filter(({ type }) => type.startsWith('js/'));
|
|
91
|
+
(0, assert_1.default)(jsModules.length === 1, `Modules must have exactly one JS output, but ${module.path ?? 'unknown module'} has ${jsModules.length} JS outputs.`);
|
|
92
|
+
const jsOutput = jsModules[0];
|
|
93
|
+
(0, assert_1.default)(Number.isFinite(jsOutput.data.lineCount), `JS output must populate lineCount, but ${module.path ?? 'unknown module'} has ${jsOutput.type} output with lineCount '${jsOutput.data.lineCount}'`);
|
|
94
|
+
return jsOutput;
|
|
133
95
|
}
|
|
96
|
+
exports.getJsOutput = getJsOutput;
|
|
134
97
|
function isJsModule(module) {
|
|
135
|
-
|
|
98
|
+
return module.output.filter(isJsOutput).length > 0;
|
|
136
99
|
}
|
|
100
|
+
exports.isJsModule = isJsModule;
|
|
137
101
|
function isJsOutput(output) {
|
|
138
|
-
|
|
102
|
+
return output.type.startsWith('js/');
|
|
139
103
|
}
|
|
104
|
+
exports.isJsOutput = isJsOutput;
|
|
140
105
|
//# sourceMappingURL=js.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js.js","
|
|
1
|
+
{"version":3,"file":"js.js","sourceRoot":"","sources":["../../../src/serializer/fork/js.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;AAEH,oDAA4B;AAC5B,gEAAsC;AAEtC,qEAAgE;AAEhE,gDAAwB;AAcxB,SAAgB,UAAU,CACxB,MAAc,EACd,OAAgB;IAEhB,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAEnC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QACvC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;KAC7C;IAED,MAAM,EAAE,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EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IAE7E,IAAA,gBAAM,EACJ,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,gDAAgD,MAAM,CAAC,IAAI,IAAI,gBAAgB,QAC7E,SAAS,CAAC,MACZ,cAAc,CACf,CAAC;IAEF,MAAM,QAAQ,GAAa,SAAS,CAAC,CAAC,CAAmB,CAAC;IAE1D,IAAA,gBAAM,EACJ,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EACxC,0CAA0C,MAAM,CAAC,IAAI,IAAI,gBAAgB,QACvE,QAAQ,CAAC,IACX,2BAA2B,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,CACtD,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAxBD,kCAwBC;AAED,SAAgB,UAAU,CAAC,MAAc;IACvC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACrD,CAAC;AAFD,gCAEC;AAED,SAAgB,UAAU,CAAC,MAAmB;IAC5C,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAFD,gCAEC"}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.processModules = processModules;
|
|
7
|
-
function _js() {
|
|
8
|
-
const data = require("./js");
|
|
9
|
-
_js = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
2
|
/**
|
|
15
3
|
* Copyright © 2022 650 Industries.
|
|
16
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -18,29 +6,27 @@ function _js() {
|
|
|
18
6
|
* This source code is licensed under the MIT license found in the
|
|
19
7
|
* LICENSE file in the root directory of this source tree.
|
|
20
8
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
skipWrapping,
|
|
43
|
-
computedAsyncModulePaths
|
|
44
|
-
})]);
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.processModules = void 0;
|
|
11
|
+
const js_1 = require("./js");
|
|
12
|
+
function processModules(modules, { filter = () => true, createModuleId, dev, includeAsyncPaths, projectRoot, serverRoot, sourceUrl, splitChunks, skipWrapping, computedAsyncModulePaths, }) {
|
|
13
|
+
return [...modules]
|
|
14
|
+
.filter(js_1.isJsModule)
|
|
15
|
+
.filter(filter)
|
|
16
|
+
.map((module) => [
|
|
17
|
+
module,
|
|
18
|
+
(0, js_1.wrapModule)(module, {
|
|
19
|
+
splitChunks,
|
|
20
|
+
createModuleId,
|
|
21
|
+
dev,
|
|
22
|
+
includeAsyncPaths,
|
|
23
|
+
projectRoot,
|
|
24
|
+
serverRoot,
|
|
25
|
+
sourceUrl,
|
|
26
|
+
skipWrapping,
|
|
27
|
+
computedAsyncModulePaths,
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
45
30
|
}
|
|
31
|
+
exports.processModules = processModules;
|
|
46
32
|
//# sourceMappingURL=processModules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processModules.js","
|
|
1
|
+
{"version":3,"file":"processModules.js","sourceRoot":"","sources":["../../../src/serializer/fork/processModules.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH,6BAA8C;AAE9C,SAAgB,cAAc,CAC5B,OAA0B,EAC1B,EACE,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,EACnB,cAAc,EACd,GAAG,EACH,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,wBAAwB,GAYzB;IAED,OAAO,CAAC,GAAG,OAAO,CAAC;SAChB,MAAM,CAAC,eAAU,CAAC;SAClB,MAAM,CAAC,MAAM,CAAC;SACd,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC;QACvB,MAAM;QACN,IAAA,eAAU,EAAC,MAAM,EAAE;YACjB,WAAW;YACX,cAAc;YACd,GAAG;YACH,iBAAiB;YACjB,WAAW;YACX,UAAU;YACV,SAAS;YACT,YAAY;YACZ,wBAAwB;SACzB,CAAC;KACH,CAAC,CAAC;AACP,CAAC;AA3CD,wCA2CC"}
|
|
@@ -1,110 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.fileNameFromContents =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const data = require("metro/src/DeltaBundler/Serializers/helpers/js");
|
|
12
|
-
_js = function () {
|
|
13
|
-
return data;
|
|
14
|
-
};
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
function _path() {
|
|
18
|
-
const data = _interopRequireDefault(require("path"));
|
|
19
|
-
_path = function () {
|
|
20
|
-
return data;
|
|
21
|
-
};
|
|
22
|
-
return data;
|
|
23
|
-
}
|
|
24
|
-
function _css() {
|
|
25
|
-
const data = require("../transform-worker/css");
|
|
26
|
-
_css = function () {
|
|
27
|
-
return data;
|
|
28
|
-
};
|
|
29
|
-
return data;
|
|
30
|
-
}
|
|
31
|
-
function _hash() {
|
|
32
|
-
const data = require("../utils/hash");
|
|
33
|
-
_hash = function () {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
return data;
|
|
37
|
-
}
|
|
38
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getFileName = exports.fileNameFromContents = exports.getCssSerialAssets = exports.filterJsModules = void 0;
|
|
7
|
+
const js_1 = require("metro/src/DeltaBundler/Serializers/helpers/js");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const css_1 = require("../transform-worker/css");
|
|
10
|
+
const hash_1 = require("../utils/hash");
|
|
39
11
|
// s = static
|
|
40
12
|
const STATIC_EXPORT_DIRECTORY = '_expo/static/css';
|
|
41
|
-
function filterJsModules(dependencies, type, {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
13
|
+
function filterJsModules(dependencies, type, { processModuleFilter, projectRoot }) {
|
|
14
|
+
const assets = [];
|
|
15
|
+
for (const module of dependencies.values()) {
|
|
16
|
+
if ((0, js_1.isJsModule)(module) &&
|
|
17
|
+
processModuleFilter(module) &&
|
|
18
|
+
(0, js_1.getJsOutput)(module).type === type &&
|
|
19
|
+
path_1.default.relative(projectRoot, module.path) !== 'package.json') {
|
|
20
|
+
assets.push(module);
|
|
21
|
+
}
|
|
49
22
|
}
|
|
50
|
-
|
|
51
|
-
return assets;
|
|
23
|
+
return assets;
|
|
52
24
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
25
|
+
exports.filterJsModules = filterJsModules;
|
|
26
|
+
function getCssSerialAssets(dependencies, { processModuleFilter, projectRoot }) {
|
|
27
|
+
const assets = [];
|
|
28
|
+
for (const module of filterJsModules(dependencies, 'js/module', {
|
|
29
|
+
processModuleFilter,
|
|
30
|
+
projectRoot,
|
|
31
|
+
})) {
|
|
32
|
+
const cssMetadata = getCssMetadata(module);
|
|
33
|
+
if (cssMetadata) {
|
|
34
|
+
const contents = cssMetadata.code;
|
|
35
|
+
const originFilename = path_1.default.relative(projectRoot, module.path);
|
|
36
|
+
const filename = path_1.default.join(
|
|
37
|
+
// Consistent location
|
|
38
|
+
STATIC_EXPORT_DIRECTORY,
|
|
39
|
+
// Hashed file contents + name for caching
|
|
40
|
+
fileNameFromContents({
|
|
41
|
+
// Stable filename for hashing in CI.
|
|
42
|
+
filepath: originFilename,
|
|
43
|
+
src: contents,
|
|
44
|
+
}) + '.css');
|
|
45
|
+
assets.push({
|
|
46
|
+
type: 'css',
|
|
47
|
+
originFilename,
|
|
48
|
+
filename,
|
|
49
|
+
source: contents,
|
|
50
|
+
metadata: {
|
|
51
|
+
hmrId: (0, css_1.pathToHtmlSafeName)(originFilename),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
82
54
|
}
|
|
83
|
-
});
|
|
84
55
|
}
|
|
85
|
-
|
|
86
|
-
return assets;
|
|
56
|
+
return assets;
|
|
87
57
|
}
|
|
58
|
+
exports.getCssSerialAssets = getCssSerialAssets;
|
|
88
59
|
function getCssMetadata(module) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
60
|
+
const data = module.output[0]?.data;
|
|
61
|
+
if (data && typeof data === 'object' && 'css' in data) {
|
|
62
|
+
if (typeof data.css !== 'object' || !('code' in data.css)) {
|
|
63
|
+
throw new Error(`Unexpected CSS metadata in Metro module (${module.path}): ${JSON.stringify(data.css)}`);
|
|
64
|
+
}
|
|
65
|
+
return data.css;
|
|
94
66
|
}
|
|
95
|
-
return
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
67
|
+
return null;
|
|
98
68
|
}
|
|
99
|
-
function fileNameFromContents({
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// Decode if the path is encoded from the Metro dev server, then normalize paths for Windows support.
|
|
104
|
-
const decoded = decodeURIComponent(filepath).replace(/\\/g, '/');
|
|
105
|
-
return getFileName(decoded) + '-' + (0, _hash().hashString)(src);
|
|
69
|
+
function fileNameFromContents({ filepath, src }) {
|
|
70
|
+
// Decode if the path is encoded from the Metro dev server, then normalize paths for Windows support.
|
|
71
|
+
const decoded = decodeURIComponent(filepath).replace(/\\/g, '/');
|
|
72
|
+
return getFileName(decoded) + '-' + (0, hash_1.hashString)(src);
|
|
106
73
|
}
|
|
74
|
+
exports.fileNameFromContents = fileNameFromContents;
|
|
107
75
|
function getFileName(module) {
|
|
108
|
-
|
|
76
|
+
return path_1.default.basename(module).replace(/\.[^.]+$/, '');
|
|
109
77
|
}
|
|
78
|
+
exports.getFileName = getFileName;
|
|
110
79
|
//# sourceMappingURL=getCssDeps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCssDeps.js","
|
|
1
|
+
{"version":3,"file":"getCssDeps.js","sourceRoot":"","sources":["../../src/serializer/getCssDeps.ts"],"names":[],"mappings":";;;;;;AACA,sEAAwF;AACxF,gDAAwB;AAGxB,iDAA6D;AAC7D,wCAA2C;AAkB3C,aAAa;AACb,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAmBnD,SAAgB,eAAe,CAC7B,YAAkC,EAClC,IAAmD,EACnD,EAAE,mBAAmB,EAAE,WAAW,EAAwD;IAE1F,MAAM,MAAM,GAAe,EAAE,CAAC;IAE9B,KAAK,MAAM,MAAM,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE;Q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;AAtCD,gDAsCC;AAED,SAAS,cAAc,CAAC,MAAgB;IACtC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IACpC,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE;QACrD,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAK,IAAY,CAAC,GAAG,CAAC,EAAE;YAClE,MAAM,IAAI,KAAK,CACb,4CAA4C,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CACxF,CAAC;SACH;QACD,OAAO,IAAI,CAAC,GAA6B,CAAC;KAC3C;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAqC;IACvF,qGAAqG;IACrG,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACjE,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,IAAA,iBAAU,EAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAJD,oDAIC;AAED,SAAgB,WAAW,CAAC,MAAc;IACxC,OAAO,cAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC;AAFD,kCAEC"}
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isExpoJsOutput = isExpoJsOutput;
|
|
7
|
-
exports.isTransformOptionTruthy = isTransformOptionTruthy;
|
|
8
|
-
/**
|
|
9
|
-
* Copyright © 2023-present 650 Industries (Expo). All rights reserved.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/
|
|
14
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTransformOptionTruthy = exports.isExpoJsOutput = void 0;
|
|
15
4
|
function isExpoJsOutput(output) {
|
|
16
|
-
|
|
5
|
+
return 'data' in output && typeof output.data === 'object';
|
|
17
6
|
}
|
|
18
|
-
|
|
7
|
+
exports.isExpoJsOutput = isExpoJsOutput;
|
|
19
8
|
// Because transform options can be passed directly during export, or through a query parameter
|
|
20
9
|
// during a request, we need to normalize the options.
|
|
21
10
|
function isTransformOptionTruthy(option) {
|
|
22
|
-
|
|
11
|
+
return option === true || option === 'true' || option === '1';
|
|
23
12
|
}
|
|
13
|
+
exports.isTransformOptionTruthy = isTransformOptionTruthy;
|
|
24
14
|
//# sourceMappingURL=jsOutput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsOutput.js","
|
|
1
|
+
{"version":3,"file":"jsOutput.js","sourceRoot":"","sources":["../../src/serializer/jsOutput.ts"],"names":[],"mappings":";;;AA4CA,SAAgB,cAAc,CAAC,MAAW;IACxC,OAAO,MAAM,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC7D,CAAC;AAFD,wCAEC;AAED,+FAA+F;AAC/F,sDAAsD;AACtD,SAAgB,uBAAuB,CAAC,MAAW;IACjD,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,GAAG,CAAC;AAChE,CAAC;AAFD,0DAEC"}
|