Skip to content

Commit

Permalink
fix: main package json (QwikDev#1826)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored Oct 21, 2022
1 parent 133612a commit 61489d3
Show file tree
Hide file tree
Showing 90 changed files with 191 additions and 167 deletions.
4 changes: 2 additions & 2 deletions packages/create-qwik/create-app.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-console */
import type { CreateAppOptions, CreateAppResult, IntegrationData } from '../qwik/src/cli/types';
import fs from 'fs';
import fs from 'node:fs';
import color from 'kleur';
import { isAbsolute, join, relative, resolve } from 'path';
import { isAbsolute, join, relative, resolve } from 'node:path';
import {
cleanPackageJson,
getPackageManager,
Expand Down
4 changes: 2 additions & 2 deletions packages/create-qwik/create-interactive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import fs from 'fs';
import { relative } from 'path';
import fs from 'node:fs';
import { relative } from 'node:path';
import prompts from 'prompts';
import color from 'kleur';
import type { CreateAppOptions } from '../qwik/src/cli/types';
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/contributors.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-console */
import fetch from 'node-fetch';
import fs from 'fs';
import path from 'path';
import url from 'url';
import fs from 'node:fs';
import path from 'node:path';
import url from 'node:url';
import matter from 'gray-matter';

const rootDir = path.join(path.dirname(url.fileURLToPath(import.meta.url)), '..', '..');
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/entry.static.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { qwikCityGenerate } from '@builder.io/qwik-city/static/node';
import render from './entry.ssr';
import { fileURLToPath } from 'url';
import { join } from 'path';
import { fileURLToPath } from 'node:url';
import { join } from 'node:path';

// Execute Qwik City Static Generator
qwikCityGenerate(render, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Usually with Vite.js we do it like this:
import { defineConfig } from 'vite';
import { qwikVite } from '@builder.io/qwik/optimizer';
import { qwikCity } from '@builder.io/qwik-city/vite';
import { resolve } from 'path';
import { resolve } from 'node:path';
/* VITE_IMPORTS */

export default defineConfig(() => {
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/routes/qwikcity/adaptors/node/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Below is an example of using the built-in Node middleware within a user's [Expre
```typescript
import { qwikCity } from '@builder.io/qwik-city/middleware/node';
import express from 'express';
import { fileURLToPath } from 'url';
import { join } from 'path';
import { fileURLToPath } from 'node:url';
import { join } from 'node:path';
import render from './entry.ssr';

// Directories where the static assets are located
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Below is an example of a `src/entry.static.tsx` file, which is the initial file
// file: src/entry.static.tsx
import { qwikCityGenerate } from '@builder.io/qwik-city/static/node';
import render from './entry.ssr';
import { fileURLToPath } from 'url';
import { join } from 'path';
import { fileURLToPath } from 'node:url';
import { join } from 'node:path';

qwikCityGenerate(render, {
origin: 'https://qwik.builder.io',
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from 'vite';
import { qwikVite } from '@builder.io/qwik/optimizer';
import { resolve } from 'path';
import { resolve } from 'node:path';
import { qwikCity } from '@builder.io/qwik-city/vite';
import { partytownVite } from '@builder.io/partytown/utils';
import { examplesData, playgroundData, tutorialData } from './vite.repl-apps';
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/vite.repl-apps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Plugin } from 'vite';
import type { TransformModuleInput } from '@builder.io/qwik/optimizer';
import { join, basename } from 'path';
import { existsSync, readdirSync, readFileSync, statSync } from 'fs';
import { join, basename } from 'node:path';
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
import type { ExampleSection } from './src/routes/examples/apps/examples-data';
import type { PlaygroundApp } from './src/routes/playground/playground-data';
import type { TutorialSection } from './src/routes/tutorial/tutorial-data';
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-qwik/qwik.unit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable */
// @ts-ignore
import Utils from '@typescript-eslint/utils';
import { fileURLToPath } from 'url';
import { fileURLToPath } from 'node:url';
import { test } from 'uvu';
import { rules } from './index';

Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/adaptors/cloudflare-pages/vite/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Plugin } from 'vite';
import type { QwikVitePlugin } from '@builder.io/qwik/optimizer';
import type { StaticGenerateOptions, StaticGenerateRenderOptions } from '../../../static';
import { join } from 'path';
import fs from 'fs';
import { join } from 'node:path';
import fs from 'node:fs';

/**
* @alpha
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/adaptors/express/vite/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Plugin } from 'vite';
import type { QwikVitePlugin } from '@builder.io/qwik/optimizer';
import type { StaticGenerateOptions, StaticGenerateRenderOptions } from '../../../static';
import { join } from 'path';
import fs from 'fs';
import { join } from 'node:path';
import fs from 'node:fs';

/**
* @alpha
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/adaptors/netlify-edge/vite/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Plugin } from 'vite';
import type { QwikVitePlugin } from '@builder.io/qwik/optimizer';
import type { StaticGenerateOptions, StaticGenerateRenderOptions } from '../../../static';
import { join } from 'path';
import fs from 'fs';
import { join } from 'node:path';
import fs from 'node:fs';

/**
* @alpha
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/adaptors/static/vite/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Plugin } from 'vite';
import type { QwikVitePlugin } from '@builder.io/qwik/optimizer';
import type { StaticGenerateRenderOptions } from '../../../static';
import { join } from 'path';
import fs from 'fs';
import { join } from 'node:path';
import fs from 'node:fs';

/**
* @alpha
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/buildtime/context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { NormalizedPluginOptions, BuildContext, PluginOptions } from './types';
import { isAbsolute, resolve } from 'path';
import { isAbsolute, resolve } from 'node:path';
import { normalizePath } from '../utils/fs';

export function createBuildContext(
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/buildtime/markdown/markdown-url.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { dirname, join, basename } from 'path';
import { dirname, join, basename } from 'node:path';
import { getSourceFile } from '../routing/source-file';
import type { NormalizedPluginOptions } from '../types';
import { getExtension, getPathnameFromDirPath, isMarkdownExt, normalizePath } from '../../utils/fs';
import { existsSync } from 'fs';
import { existsSync } from 'node:fs';
import { isSameOriginUrl } from '../../utils/pathname';

export function getMarkdownRelativeUrl(
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/buildtime/markdown/markdown-url.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { test } from 'uvu';
import { equal } from 'uvu/assert';
import { getMarkdownRelativeUrl } from './markdown-url';
import type { NormalizedPluginOptions } from '../types';
import { tmpdir } from 'os';
import { join } from 'path';
import { tmpdir } from 'node:os';
import { join } from 'node:path';

test('getMarkdownRelativeUrl', () => {
const routesDir = tmpdir();
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/buildtime/markdown/menu.unit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join } from 'path';
import { join } from 'node:path';
import * as assert from 'uvu/assert';
import { createMenu, parseMenu } from './menu';
import { suite } from '../../utils/test-suite';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dirname } from 'path';
import { dirname } from 'node:path';
import { resolveMenu } from '../markdown/menu';
import type {
BuildEntry,
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/buildtime/routing/walk-routes-dir.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import { basename, join } from 'path';
import fs from 'node:fs';
import { basename, join } from 'node:path';
import type { RouteSourceFile } from '../types';
import { normalizePath } from '../../utils/fs';
import { getSourceFile } from './source-file';
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/buildtime/vite/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import { basename } from 'path';
// import { basename } from 'node:path';
import { ConfigEnv, mergeConfig, UserConfigExport } from 'vite';

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/qwik-city/buildtime/vite/dev-server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ViteDevServer, Connect } from 'vite';
import type { ServerResponse } from 'http';
import fs from 'fs';
import { join, resolve } from 'path';
import type { ServerResponse } from 'node:http';
import fs from 'node:fs';
import { join, resolve } from 'node:path';
import type { BuildContext } from '../types';
import type { RouteModule } from '../../runtime/src/library/types';
import type { QwikViteDevResponse } from '../../../qwik/src/optimizer/src/plugins/vite';
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/buildtime/vite/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createMdxTransformer, MdxTransform } from '../markdown/mdx';
import { basename, join, resolve } from 'path';
import { basename, join, resolve } from 'node:path';
import type { Plugin, UserConfig } from 'vite';
import { generateQwikCityPlan } from '../runtime-generation/generate-qwik-city-plan';
import type { BuildContext } from '../types';
Expand All @@ -20,7 +20,7 @@ import { transformMenu } from '../markdown/menu';
import { generateQwikCityEntries } from '../runtime-generation/generate-entries';
import { patchGlobalFetch } from '../../middleware/node/node-fetch';
import type { QwikManifest } from '@builder.io/qwik/optimizer';
import fs from 'fs';
import fs from 'node:fs';
import {
generateServiceWorkerRegister,
prependManifestToServiceWorker,
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/buildtime/vite/validate-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import { isAbsolute } from 'path';
import fs from 'node:fs';
import { isAbsolute } from 'node:path';
import type { NormalizedPluginOptions } from '../types';

export async function validatePlugin(opts: NormalizedPluginOptions) {
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/middleware/node/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

/// <reference types="node" />

import type { IncomingMessage } from 'http';
import type { IncomingMessage } from 'node:http';
import type { Render } from '@builder.io/qwik/server';
import type { RenderOptions } from '@builder.io/qwik/server';
import type { RenderOptions as RenderOptions_2 } from '@builder.io/qwik';
import type { ServerResponse } from 'http';
import type { ServerResponse } from 'node:http';

// @alpha (undocumented)
export function createQwikCity(opts: QwikCityNodeRequestOptions): {
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/middleware/node/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IncomingMessage, ServerResponse } from 'http';
import type { IncomingMessage, ServerResponse } from 'node:http';
import { createHeaders } from '../request-handler/headers';
import type { QwikCityRequestContext } from '../request-handler/types';

Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/middleware/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IncomingMessage, ServerResponse } from 'http';
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { QwikCityHandlerOptions } from '../request-handler/types';
import { errorHandler, notFoundHandler, requestHandler } from '../request-handler';
import { fromNodeHttp, getUrl } from './http';
Expand Down
3 changes: 2 additions & 1 deletion packages/qwik-city/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "@builder.io/qwik-city",
"version": "0.0.113",
"description": "The meta-framework for Qwik.",
"main": "./lib/index.qwik.cjs",
"main": "./lib/index.qwik.mjs",
"module": "./lib/index.qwik.mjs",
"qwik": "./lib/index.qwik.mjs",
"types": "./lib/index.d.ts",
"type": "module",
"exports": {
".": {
"types": "./lib/index.d.ts",
"import": "./lib/index.qwik.mjs",
"require": "./lib/index.qwik.cjs"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RequestHandler } from '~qwik-city-runtime';
import os from 'os';
import os from 'node:os';

export const onGet: RequestHandler = ({ request, params }) => {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RequestHandler } from '~qwik-city-runtime';
import os from 'os';
import os from 'node:os';

export const onGet: RequestHandler = ({ request }) => {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Resource, component$, useStore } from '@builder.io/qwik';
import { Link, useEndpoint, useLocation, RequestHandler, DocumentHead } from '~qwik-city-runtime';
import os from 'os';
import os from 'node:os';

export default component$(() => {
const { params, pathname } = useLocation();
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/runtime/src/entry.express.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express from 'express';
import { fileURLToPath } from 'url';
import { join } from 'path';
import { fileURLToPath } from 'node:url';
import { join } from 'node:path';
import { qwikCity } from '../../middleware/node';
import render from './entry.ssr';

Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/static/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { StaticGenerateOptions } from '../types';
import { createSystem } from './node-system';
import { isMainThread, workerData } from 'worker_threads';
import { isMainThread, workerData } from 'node:worker_threads';
import { mainThread } from '../main-thread';
import { workerThread } from '../worker-thread';

Expand Down
8 changes: 4 additions & 4 deletions packages/qwik-city/static/node/node-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import type {
WorkerOutputMessage,
WorkerInputMessage,
} from '../types';
import fs from 'fs';
import { cpus as nodeCpus } from 'os';
import { Worker } from 'worker_threads';
import { isAbsolute, resolve } from 'path';
import fs from 'node:fs';
import { cpus as nodeCpus } from 'node:os';
import { Worker } from 'node:worker_threads';
import { isAbsolute, resolve } from 'node:path';
import { ensureDir } from './node-system';
import { normalizePath } from '../../utils/fs';

Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/static/node/node-system.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-console */
import type { StaticGenerateOptions, System } from '../types';
import fs from 'fs';
import { dirname, join } from 'path';
import fs from 'node:fs';
import { dirname, join } from 'node:path';
import { patchGlobalFetch } from '../../middleware/node/node-fetch';
import { createNodeMainProcess } from './node-main';
import { createNodeWorkerProcess } from './node-worker';
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/static/node/node-worker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parentPort } from 'worker_threads';
import { parentPort } from 'node:worker_threads';
import type { WorkerInputMessage, WorkerOutputMessage } from '../types';

export async function createNodeWorkerProcess(
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/utils/fs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { basename, dirname, normalize, relative } from 'path';
import { basename, dirname, normalize, relative } from 'node:path';
import type { NormalizedPluginOptions } from '../buildtime/types';
import { toTitleCase } from './format';
import { normalizePathname } from './pathname';
Expand Down
4 changes: 2 additions & 2 deletions packages/qwik-city/utils/fs.unit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { tmpdir } from 'os';
import { join } from 'path';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { test } from 'uvu';
import { equal } from 'uvu/assert';
import type { NormalizedPluginOptions } from '../buildtime/types';
Expand Down
6 changes: 3 additions & 3 deletions packages/qwik-city/utils/test-suite.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
import * as assert from 'uvu/assert';
import { join } from 'path';
import { join } from 'node:path';
import { suite as uvuSuite } from 'uvu';
import type {
BuildContext,
Expand All @@ -10,10 +10,10 @@ import type {
NormalizedPluginOptions,
} from '../buildtime/types';
import { createBuildContext } from '../buildtime/context';
import { tmpdir } from 'os';
import { tmpdir } from 'node:os';
import { normalizePath } from './fs';
import { build } from '../buildtime/build';
import { fileURLToPath } from 'url';
import { fileURLToPath } from 'node:url';

export function suite(title?: string) {
const s = uvuSuite<TestContext>(title);
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"url": "https://github.com/BuilderIO/qwik/issues"
},
"type": "module",
"main": "./lib/index.qwik.cjs",
"main": "./lib/index.qwik.mjs",
"module": "./lib/index.qwik.mjs",
"qwik": "./lib/index.qwik.mjs",
"types": "./lib/types/index.d.ts"
Expand Down
3 changes: 2 additions & 1 deletion packages/qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "@builder.io/qwik",
"version": "0.11.1",
"description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.",
"main": "./dist/core.cjs",
"main": "./dist/core.mjs",
"module": "./dist/core.mjs",
"types": "./dist/core.d.ts",
"bin": "./dist/qwik.cjs",
"type": "module",
Expand Down
Loading

0 comments on commit 61489d3

Please sign in to comment.