Skip to content

Commit

Permalink
fix(pkg): rename mjs to js; added type module
Browse files Browse the repository at this point in the history
  • Loading branch information
ThornWalli committed Dec 14, 2023
1 parent 7a5b262 commit 5072a98
Show file tree
Hide file tree
Showing 67 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ commitlint.config.js
renovate.json
vetur.config.json
sandbox.config.json
build.config.mjs
build.config.js
.output

/docs
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions commitlint.config.js

This file was deleted.

2 changes: 2 additions & 0 deletions commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const config = { extends: ['@commitlint/config-conventional'] };
export default config;
2 changes: 1 addition & 1 deletion docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fileURLToPath } from 'url';
import { defineConfig } from 'vitepress';
import markdownItInlineComments from 'markdown-it-inline-comments';
import navigation from './navigation.mjs';
import navigation from './navigation.js';

// https://vitepress.dev/reference/site-config
export default defineConfig(() => ({
Expand Down
2 changes: 1 addition & 1 deletion docs/components/VPNavBarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useData } from 'vitepress/dist/client/theme-default/composables/data';
import VPNavBarMenuLink from 'vitepress/dist/client/theme-default/components/VPNavBarMenuLink.vue';
import VPNavBarMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavBarMenuGroup.vue';
import { useVersion } from '../composables/version.mjs';
import { useVersion } from '../composables/version.js';
const { theme } = useData();
Expand Down
2 changes: 1 addition & 1 deletion docs/components/VPNavScreenMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useData } from 'vitepress/dist/client/theme-default/composables/data';
import VPNavScreenMenuLink from 'vitepress/dist/client/theme-default/components/VPNavScreenMenuLink.vue';
import VPNavScreenMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavScreenMenuGroup.vue';
import { useVersion } from '../composables/version.mjs';
import { useVersion } from '../composables/version.js';
const { theme } = useData();
const { nav: versionNav } = useVersion();
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"type": "git",
"url": "https://github.com/GrabarzUndPartner/nuxt-speedkit"
},
"type": "module",
"scripts": {
"prepack": "nuxt-module-build",
"postinstall": "husky install",
Expand All @@ -27,7 +28,7 @@
"generate": "nuxt generate playground",
"preview": "nuxt preview",
"lint": "npm run lint:css && npm run lint:es",
"lint:es": "eslint --fix --ext .js,.mjs,.vue .",
"lint:es": "eslint --fix --ext .js,.js,.vue .",
"lint:css": "stylelint \"(src|playground)/**/*.vue\"",
"lint:report": "eslint --ext .js,.vue -f json-relative -o ./eslint-report.json .",
"test": "npm run vitest:run",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { basename, dirname, join, resolve } from 'pathe';
import { parseDocument } from 'htmlparser2';
import { load } from 'cheerio';
import { render } from 'dom-serializer';
import { isWebpackBuild, logger } from '../../utils.mjs';
import { isWebpackBuild, logger } from '../../utils.js';

export default (nuxt, options = { manifest: [] }) =>
nitro => {
Expand Down
File renamed without changes.
File renamed without changes.
30 changes: 15 additions & 15 deletions src/module.mjs → src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
addPluginTemplate,
addTemplate
} from '@nuxt/kit';
import { getCrossorigin } from './runtime/utils.mjs';
import FontConfig from './runtime/classes/FontConfig.mjs';
import { getCrossorigin } from './runtime/utils.js';
import FontConfig from './runtime/classes/FontConfig.js';
import {
DEFAULT_TARGET_FORMATS,
MODULE_NAME,
Expand All @@ -16,16 +16,16 @@ import {
isWebpackBuild,
logger,
setPublicRuntimeConfig
} from './utils.mjs';
} from './utils.js';
import {
deprecationsNotification,
getDefaultOptions
} from './utils/options.mjs';
import { getFontConfigTemplate } from './utils/template.mjs';
import { optimizePreloads } from './utils/preload.mjs';
import { getSupportedBrowserDetector } from './utils/browser.mjs';
import { registerAppEntry as registerAppEntryWebpack } from './hookFunctions/webpack.mjs';
import { registerAppEntry as registerAppEntryVite } from './hookFunctions/vite.mjs';
} from './utils/options.js';
import { getFontConfigTemplate } from './utils/template.js';
import { optimizePreloads } from './utils/preload.js';
import { getSupportedBrowserDetector } from './utils/browser.js';
import { registerAppEntry as registerAppEntryWebpack } from './hookFunctions/webpack.js';
import { registerAppEntry as registerAppEntryVite } from './hookFunctions/vite.js';

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

Expand Down Expand Up @@ -55,14 +55,14 @@ export default defineNuxtModule({
nuxt.hook(
'webpack:config',
registerAppEntryWebpack(
resolve(nuxt.options.buildDir, MODULE_NAME, 'entry.mjs')
resolve(nuxt.options.buildDir, MODULE_NAME, 'entry.js')
)
);
} else {
nuxt.hook(
'vite:extend',
registerAppEntryVite(
resolve(nuxt.options.buildDir, MODULE_NAME, 'entry.mjs')
resolve(nuxt.options.buildDir, MODULE_NAME, 'entry.js')
)
);
}
Expand Down Expand Up @@ -97,7 +97,7 @@ async function addBuildTemplates(nuxt, options) {
});

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

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

addTemplate({
src: resolver.resolve('runtime/tmpl', 'entry.mjs'),
fileName: MODULE_NAME + '/entry.mjs',
src: resolver.resolve('runtime/tmpl', 'entry.js'),
fileName: MODULE_NAME + '/entry.js',
write: true,
options: {
webpack: isWebpackBuild(nuxt),
Expand Down
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.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/runtime/components/SpeedkitImage/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</template>

<script>
import { crossorigin as validatorCrossorigin } from '../../utils/validators.mjs';
import { getImageStyleDescription } from '#speedkit/utils/description.mjs';
import { crossorigin as validatorCrossorigin } from '../../utils/validators.js';
import { getImageStyleDescription } from '#speedkit/utils/description.js';
import { getCrossorigin } from '#speedkit/utils';
import Source from '#speedkit/components/SpeedkitImage/classes/Source';
import useCritical from '#speedkit/composables/critical';
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/components/SpeedkitPicture/Base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
</template>

<script>
import { getPictureStyleDescription } from '../../utils/description.mjs';
import { crossorigin as validatorCrossorigin } from '../../utils/validators.mjs';
import { getPictureStyleDescription } from '../../utils/description.js';
import { crossorigin as validatorCrossorigin } from '../../utils/validators.js';
import useCritical from '#speedkit/composables/critical';
import BaseImage from '#speedkit/components/SpeedkitImage/Base';
import SourceList from '#speedkit/components/SpeedkitPicture/classes/SourceList';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ready } from '../utils/loader.mjs';
import { ready } from '../utils/loader.js';

export default class Youtube {
api;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/runtime/tmpl/entry.mjs → src/runtime/tmpl/entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { <% if (options.performanceCheck) { %>run, <% } %>hasSufficientPerformance, setup } from '#speedkit/utils/performance';
import { triggerRunCallback, observeSpeedkitButton, setupSpeedkitLayer, updateSpeedkitLayerMessage, initReducedView } from '#speedkit/utils/entry';
import Deferred from '#speedkit/classes/Deferred.mjs';
import Deferred from '#speedkit/classes/Deferred.js';
import { isSupportedBrowser } from '#speedkit/utils/browser';

<% if (options.webpack) { %>
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/tmpl/plugin.mjs → src/runtime/tmpl/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineNuxtPlugin({
enforce: 'post',
async setup(nuxtApp) {

const fontConfig = await import('./fontConfig.mjs').then(
const fontConfig = await import('./fontConfig.js').then(
module => module.default || module
);
const fontList = new FontList(fontConfig);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/runtime/utils/entry.mjs → src/runtime/utils/entry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hasSufficientDownloadPerformance } from './performance.mjs';
import { hasSufficientDownloadPerformance } from './performance.js';

export const triggerRunCallback = sufficient =>
window.dispatchEvent(
Expand Down
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.
2 changes: 1 addition & 1 deletion src/utils/options.mjs → src/utils/options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logger } from '../utils.mjs';
import { logger } from '../utils.js';

export function getDefaultOptions() {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/preload.mjs → src/utils/preload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import initHook from '../hookFunctions/nitro/init.mjs';
import { isViteBuild, isWebpackBuild, logger } from '../utils.mjs';
import initHook from '../hookFunctions/nitro/init.js';
import { isViteBuild, isWebpackBuild, logger } from '../utils.js';

export function optimizePreloads(moduleOptions, nuxt) {
nuxt.options.experimental.inlineSSRStyles = false;
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/default.test.mjs → test/default.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { beforeAll } from 'vitest';
import { startStaticServer } from './utils';
import html from './tests/html.mjs';
import browser from './tests/browser.mjs';
import html from './tests/html.js';
import browser from './tests/browser.js';

import { distDir } from './nuxt.config.mjs';
import { distDir } from './nuxt.config.js';

const runtime = { serverUrl: null };

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/nuxt.config.mjs → test/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineNuxtConfig } from 'nuxt/config';
import { createResolver } from '@nuxt/kit';

import { join, resolve } from 'pathe';
import nuxtConfig from '../playground/nuxt.config.mjs';
import nuxtConfig from '../playground/nuxt.config.js';

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

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/tests/html.mjs → test/tests/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { join } from 'pathe';
import { describe, it, expect } from 'vitest';
import { getDom, getLinkPreloadKey, getHTML } from '../utils.mjs';
import { getDom, getLinkPreloadKey, getHTML } from '../utils.js';

export default distDir => {
describe('🧐 inspect html', () => {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
include: ['test/*.test.mjs'],
include: ['test/*.test.js'],
testTimeout: 60_000,
hookTimeout: 140_000
},
Expand Down

0 comments on commit 5072a98

Please sign in to comment.