rusackas commented on code in PR #43686:
URL: https://github.com/apache/superset/pull/43686#discussion_r3890294579
##########
superset-frontend/scripts/bundle-size-summary.js:
##########
@@ -79,8 +80,11 @@ function main() {
console.log(JSON.stringify(results, null, 2));
}
-if (require.main === module) {
+const isMain =
+ process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;
+
+if (isMain) {
main();
}
-module.exports = { entrypointSizeByExt, main, TRACKED_ENTRYPOINTS };
+export default { entrypointSizeByExt, main, TRACKED_ENTRYPOINTS };
Review Comment:
Stale, the jest test now imports `entrypointSizeByExt`/`main` straight from
`scripts/internal/bundle-size-summary.js` (the real ESM module), not the CJS
shim. Nothing else requires the shim's named exports, its only other caller is
the CLI invocation in the nightly/frontend workflows, which just runs `main()`
directly. Resolving.
##########
superset-frontend/src/types/yaml.d.ts:
##########
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+declare module '*.yaml' {
+ const content: string;
+ export default content;
+}
+
+declare module '*.yml' {
+ const content: string;
+ export default content;
+}
Review Comment:
Stale too, current declaration is `const content: Record<string, any>;
export default content;`, not a string. And textUtils.ts still loads it through
`require(...)`, not a dynamic `import()`, so no module-namespace wrapping
either. Resolving.
##########
superset-frontend/scripts/oxlint-metrics-uploader.js:
##########
@@ -280,8 +280,8 @@ async function runOxlintAndProcess() {
// Run the process, unless this file was imported (e.g. by a test) rather than
// executed, in which case nothing should be linted or uploaded on import.
-if (require.main === module) {
+if (__filename === process.argv[1]) {
runOxlintAndProcess().catch(console.error);
}
-module.exports = { parseRuleId };
+export default { parseRuleId };
Review Comment:
Also stale, `__filename` is derived via `fileURLToPath(import.meta.url)` a
few lines up now, same pattern as the other migrated scripts. Resolving.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]