Skip to content

Commit 5072a98

Browse files
committed
fix(pkg): rename mjs to js; added type module
1 parent 7a5b262 commit 5072a98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+41
-41
lines changed

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ commitlint.config.js
3131
renovate.json
3232
vetur.config.json
3333
sandbox.config.json
34-
build.config.mjs
34+
build.config.js
3535
.output
3636

3737
/docs
File renamed without changes.

commitlint.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

commitlint.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const config = { extends: ['@commitlint/config-conventional'] };
2+
export default config;

docs/.vitepress/config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { fileURLToPath } from 'url';
22
import { defineConfig } from 'vitepress';
33
import markdownItInlineComments from 'markdown-it-inline-comments';
4-
import navigation from './navigation.mjs';
4+
import navigation from './navigation.js';
55

66
// https://vitepress.dev/reference/site-config
77
export default defineConfig(() => ({

docs/components/VPNavBarMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useData } from 'vitepress/dist/client/theme-default/composables/data';
33
import VPNavBarMenuLink from 'vitepress/dist/client/theme-default/components/VPNavBarMenuLink.vue';
44
import VPNavBarMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavBarMenuGroup.vue';
5-
import { useVersion } from '../composables/version.mjs';
5+
import { useVersion } from '../composables/version.js';
66
77
const { theme } = useData();
88

docs/components/VPNavScreenMenu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useData } from 'vitepress/dist/client/theme-default/composables/data';
33
import VPNavScreenMenuLink from 'vitepress/dist/client/theme-default/components/VPNavScreenMenuLink.vue';
44
import VPNavScreenMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavScreenMenuGroup.vue';
5-
import { useVersion } from '../composables/version.mjs';
5+
import { useVersion } from '../composables/version.js';
66
77
const { theme } = useData();
88
const { nav: versionNav } = useVersion();
File renamed without changes.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"type": "git",
1818
"url": "https://github.com/GrabarzUndPartner/nuxt-speedkit"
1919
},
20+
"type": "module",
2021
"scripts": {
2122
"prepack": "nuxt-module-build",
2223
"postinstall": "husky install",
@@ -27,7 +28,7 @@
2728
"generate": "nuxt generate playground",
2829
"preview": "nuxt preview",
2930
"lint": "npm run lint:css && npm run lint:es",
30-
"lint:es": "eslint --fix --ext .js,.mjs,.vue .",
31+
"lint:es": "eslint --fix --ext .js,.js,.vue .",
3132
"lint:css": "stylelint \"(src|playground)/**/*.vue\"",
3233
"lint:report": "eslint --ext .js,.vue -f json-relative -o ./eslint-report.json .",
3334
"test": "npm run vitest:run",
File renamed without changes.

src/hookFunctions/nitro/init.mjs renamed to src/hookFunctions/nitro/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { basename, dirname, join, resolve } from 'pathe';
33
import { parseDocument } from 'htmlparser2';
44
import { load } from 'cheerio';
55
import { render } from 'dom-serializer';
6-
import { isWebpackBuild, logger } from '../../utils.mjs';
6+
import { isWebpackBuild, logger } from '../../utils.js';
77

88
export default (nuxt, options = { manifest: [] }) =>
99
nitro => {
File renamed without changes.
File renamed without changes.

src/module.mjs renamed to src/module.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
addPluginTemplate,
77
addTemplate
88
} from '@nuxt/kit';
9-
import { getCrossorigin } from './runtime/utils.mjs';
10-
import FontConfig from './runtime/classes/FontConfig.mjs';
9+
import { getCrossorigin } from './runtime/utils.js';
10+
import FontConfig from './runtime/classes/FontConfig.js';
1111
import {
1212
DEFAULT_TARGET_FORMATS,
1313
MODULE_NAME,
@@ -16,16 +16,16 @@ import {
1616
isWebpackBuild,
1717
logger,
1818
setPublicRuntimeConfig
19-
} from './utils.mjs';
19+
} from './utils.js';
2020
import {
2121
deprecationsNotification,
2222
getDefaultOptions
23-
} from './utils/options.mjs';
24-
import { getFontConfigTemplate } from './utils/template.mjs';
25-
import { optimizePreloads } from './utils/preload.mjs';
26-
import { getSupportedBrowserDetector } from './utils/browser.mjs';
27-
import { registerAppEntry as registerAppEntryWebpack } from './hookFunctions/webpack.mjs';
28-
import { registerAppEntry as registerAppEntryVite } from './hookFunctions/vite.mjs';
23+
} from './utils/options.js';
24+
import { getFontConfigTemplate } from './utils/template.js';
25+
import { optimizePreloads } from './utils/preload.js';
26+
import { getSupportedBrowserDetector } from './utils/browser.js';
27+
import { registerAppEntry as registerAppEntryWebpack } from './hookFunctions/webpack.js';
28+
import { registerAppEntry as registerAppEntryVite } from './hookFunctions/vite.js';
2929

3030
const resolver = createResolver(import.meta.url);
3131

@@ -55,14 +55,14 @@ export default defineNuxtModule({
5555
nuxt.hook(
5656
'webpack:config',
5757
registerAppEntryWebpack(
58-
resolve(nuxt.options.buildDir, MODULE_NAME, 'entry.mjs')
58+
resolve(nuxt.options.buildDir, MODULE_NAME, 'entry.js')
5959
)
6060
);
6161
} else {
6262
nuxt.hook(
6363
'vite:extend',
6464
registerAppEntryVite(
65-
resolve(nuxt.options.buildDir, MODULE_NAME, 'entry.mjs')
65+
resolve(nuxt.options.buildDir, MODULE_NAME, 'entry.js')
6666
)
6767
);
6868
}
@@ -97,7 +97,7 @@ async function addBuildTemplates(nuxt, options) {
9797
});
9898

9999
addTemplate({
100-
filename: MODULE_NAME + '/fontConfig.mjs',
100+
filename: MODULE_NAME + '/fontConfig.js',
101101
getContents: () => getFontConfigTemplate(fontConfig),
102102
write: true
103103
});
@@ -111,7 +111,7 @@ async function addBuildTemplates(nuxt, options) {
111111

112112
['client', 'server'].forEach(mode => {
113113
addPluginTemplate({
114-
src: resolver.resolve('runtime/tmpl', 'plugin.mjs'),
114+
src: resolver.resolve('runtime/tmpl', 'plugin.js'),
115115
fileName: MODULE_NAME + `/plugin.${mode}.js`,
116116
write: true,
117117
mode,
@@ -127,8 +127,8 @@ async function addBuildTemplates(nuxt, options) {
127127
});
128128

129129
addTemplate({
130-
src: resolver.resolve('runtime/tmpl', 'entry.mjs'),
131-
fileName: MODULE_NAME + '/entry.mjs',
130+
src: resolver.resolve('runtime/tmpl', 'entry.js'),
131+
fileName: MODULE_NAME + '/entry.js',
132132
write: true,
133133
options: {
134134
webpack: isWebpackBuild(nuxt),
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/runtime/components/SpeedkitImage/Base.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</template>
1818

1919
<script>
20-
import { crossorigin as validatorCrossorigin } from '../../utils/validators.mjs';
21-
import { getImageStyleDescription } from '#speedkit/utils/description.mjs';
20+
import { crossorigin as validatorCrossorigin } from '../../utils/validators.js';
21+
import { getImageStyleDescription } from '#speedkit/utils/description.js';
2222
import { getCrossorigin } from '#speedkit/utils';
2323
import Source from '#speedkit/components/SpeedkitImage/classes/Source';
2424
import useCritical from '#speedkit/composables/critical';

src/runtime/components/SpeedkitPicture/Base.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
</template>
2020

2121
<script>
22-
import { getPictureStyleDescription } from '../../utils/description.mjs';
23-
import { crossorigin as validatorCrossorigin } from '../../utils/validators.mjs';
22+
import { getPictureStyleDescription } from '../../utils/description.js';
23+
import { crossorigin as validatorCrossorigin } from '../../utils/validators.js';
2424
import useCritical from '#speedkit/composables/critical';
2525
import BaseImage from '#speedkit/components/SpeedkitImage/Base';
2626
import SourceList from '#speedkit/components/SpeedkitPicture/classes/SourceList';

src/runtime/components/SpeedkitYoutube/classes/Youtube.mjs renamed to src/runtime/components/SpeedkitYoutube/classes/Youtube.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ready } from '../utils/loader.mjs';
1+
import { ready } from '../utils/loader.js';
22

33
export default class Youtube {
44
api;
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/runtime/tmpl/entry.mjs renamed to src/runtime/tmpl/entry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { <% if (options.performanceCheck) { %>run, <% } %>hasSufficientPerformance, setup } from '#speedkit/utils/performance';
22
import { triggerRunCallback, observeSpeedkitButton, setupSpeedkitLayer, updateSpeedkitLayerMessage, initReducedView } from '#speedkit/utils/entry';
3-
import Deferred from '#speedkit/classes/Deferred.mjs';
3+
import Deferred from '#speedkit/classes/Deferred.js';
44
import { isSupportedBrowser } from '#speedkit/utils/browser';
55

66
<% if (options.webpack) { %>

src/runtime/tmpl/plugin.mjs renamed to src/runtime/tmpl/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default defineNuxtPlugin({
99
enforce: 'post',
1010
async setup(nuxtApp) {
1111

12-
const fontConfig = await import('./fontConfig.mjs').then(
12+
const fontConfig = await import('./fontConfig.js').then(
1313
module => module.default || module
1414
);
1515
const fontList = new FontList(fontConfig);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/runtime/utils/entry.mjs renamed to src/runtime/utils/entry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { hasSufficientDownloadPerformance } from './performance.mjs';
1+
import { hasSufficientDownloadPerformance } from './performance.js';
22

33
export const triggerRunCallback = sufficient =>
44
window.dispatchEvent(
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/utils/options.mjs renamed to src/utils/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { logger } from '../utils.mjs';
1+
import { logger } from '../utils.js';
22

33
export function getDefaultOptions() {
44
return {

src/utils/preload.mjs renamed to src/utils/preload.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import initHook from '../hookFunctions/nitro/init.mjs';
2-
import { isViteBuild, isWebpackBuild, logger } from '../utils.mjs';
1+
import initHook from '../hookFunctions/nitro/init.js';
2+
import { isViteBuild, isWebpackBuild, logger } from '../utils.js';
33

44
export function optimizePreloads(moduleOptions, nuxt) {
55
nuxt.options.experimental.inlineSSRStyles = false;
File renamed without changes.

test/default.test.mjs renamed to test/default.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { beforeAll } from 'vitest';
22
import { startStaticServer } from './utils';
3-
import html from './tests/html.mjs';
4-
import browser from './tests/browser.mjs';
3+
import html from './tests/html.js';
4+
import browser from './tests/browser.js';
55

6-
import { distDir } from './nuxt.config.mjs';
6+
import { distDir } from './nuxt.config.js';
77

88
const runtime = { serverUrl: null };
99

File renamed without changes.

test/nuxt.config.mjs renamed to test/nuxt.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineNuxtConfig } from 'nuxt/config';
22
import { createResolver } from '@nuxt/kit';
33

44
import { join, resolve } from 'pathe';
5-
import nuxtConfig from '../playground/nuxt.config.mjs';
5+
import nuxtConfig from '../playground/nuxt.config.js';
66

77
const resolver = createResolver(import.meta.url);
88

File renamed without changes.

test/tests/html.mjs renamed to test/tests/html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { join } from 'pathe';
44
import { describe, it, expect } from 'vitest';
5-
import { getDom, getLinkPreloadKey, getHTML } from '../utils.mjs';
5+
import { getDom, getLinkPreloadKey, getHTML } from '../utils.js';
66

77
export default distDir => {
88
describe('🧐 inspect html', () => {
File renamed without changes.

vitest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineConfig } from 'vitest/config';
33

44
export default defineConfig({
55
test: {
6-
include: ['test/*.test.mjs'],
6+
include: ['test/*.test.js'],
77
testTimeout: 60_000,
88
hookTimeout: 140_000
99
},

0 commit comments

Comments
 (0)