Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v3 #15

Merged
merged 49 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0eb62c6
feat: new vite ingration
Julien-R44 Feb 26, 2024
0e520f0
chore: update publish config
Julien-R44 Feb 26, 2024
8d2c7b3
chore: update version
Julien-R44 Feb 26, 2024
0817ee0
chore(release): 3.0.0-0
Julien-R44 Feb 26, 2024
898bd11
fix: build hook module
Julien-R44 Feb 26, 2024
6d9dcd6
chore: add funding
Julien-R44 Feb 26, 2024
b7af53a
chore: bundle using tsup-node
Julien-R44 Feb 26, 2024
1a2d058
chore: update dependencies
Julien-R44 Feb 26, 2024
60bc5e7
chore: update shield peer dep version
Julien-R44 Feb 26, 2024
740a214
chore(release): 3.0.0-1
Julien-R44 Feb 26, 2024
5d7dd7f
fix: tsup published files
Julien-R44 Feb 26, 2024
317018d
chore(release): 3.0.0-2
Julien-R44 Feb 26, 2024
6f63be8
fix: register edge in production
Julien-R44 Feb 26, 2024
60536ec
refactor: remove application dev dependency
Julien-R44 Feb 27, 2024
f034b33
chore: restore gitignore and prettierignore
Julien-R44 Feb 27, 2024
cd12fbb
refactor: add back edge plugin entrypoint
Julien-R44 Feb 27, 2024
8e65616
refactor: register vite middleware in boot method
Julien-R44 Feb 27, 2024
51ef82e
refactor: run dev server only in test & web environments
Julien-R44 Feb 27, 2024
c739008
chore: doc provider
Julien-R44 Feb 27, 2024
cf8fa08
chore(release): 3.0.0-3
Julien-R44 Feb 27, 2024
a08281a
chore: middleware typo
Julien-R44 Feb 28, 2024
0bd9bc0
feat: csp support
Julien-R44 Feb 29, 2024
ba88a39
chore: add japa snapshot plugin
Julien-R44 Mar 2, 2024
5045c81
feat: add support for preloading assets in production
Julien-R44 Mar 2, 2024
b5db462
test: fix failing test
Julien-R44 Mar 2, 2024
7808f0d
chore(release): 3.0.0-4
Julien-R44 Mar 2, 2024
6d9d685
fix: create a new runtime instead of caching one
Julien-R44 Mar 4, 2024
c8a5629
fix: createRuntime
Julien-R44 Mar 4, 2024
970d6e5
chore(release): 3.0.0-5
Julien-R44 Mar 4, 2024
e3a6f60
feat: allow options to be passed to createDevServer
Julien-R44 Mar 4, 2024
0ea214d
chore(release): 3.0.0-6
Julien-R44 Mar 4, 2024
9ced08b
fix: enforce `post` for config plugin
Julien-R44 Mar 4, 2024
7b0af6f
chore(release): 3.0.0-7
Julien-R44 Mar 4, 2024
c270352
fix: aliases not flattened
Julien-R44 Mar 6, 2024
80b8c8b
chore(release): 3.0.0-8
Julien-R44 Mar 6, 2024
9b6f1b9
refactor!: remove vite config builtin aliases
Julien-R44 Mar 7, 2024
76016e4
perf: improve boot time of the provider
Julien-R44 Mar 25, 2024
b8dc984
fix: config/vite.stub file not found
Julien-R44 Mar 25, 2024
15bef87
feat: prevent fouc in development (#12)
Julien-R44 Mar 25, 2024
b361982
chore(release): 3.0.0-9
Julien-R44 Mar 25, 2024
e277ffd
fix: move to warmupRequest
Julien-R44 Mar 27, 2024
bcaf3cb
refactor: remove hardcoded hmr port
Julien-R44 Mar 27, 2024
3458762
chore(release): 3.0.0-10
Julien-R44 Mar 27, 2024
b9f444a
fix: handle cors issue (#14)
Julien-R44 Mar 30, 2024
d188dc6
chore(release): 3.0.0-11
Julien-R44 Mar 30, 2024
69938d5
chore: update dependencies
Julien-R44 Jun 2, 2024
6ec26e8
feat(configure): add assembler hook automatically
Julien-R44 Jun 2, 2024
d347099
chore: update missing dependencies
Julien-R44 Jun 2, 2024
749a040
feat: add assetsBundler: false through codemods
Julien-R44 Jun 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,5 @@ insert_final_newline = true
[*.json]
insert_final_newline = ignore

[**.min.js]
indent_style = ignore
insert_final_newline = ignore

[MakeFile]
indent_style = space

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [thetutlage, Julien-R44]
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License

Copyright 2022 Harminder Virk, contributors
Copyright (c) 2023

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
44 changes: 34 additions & 10 deletions bin/test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
/*
* @adonisjs/vite
*
* (c) AdonisJS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

import { assert } from '@japa/assert'
import { snapshot } from '@japa/snapshot'
import { fileSystem } from '@japa/file-system'
import { expectTypeOf } from '@japa/expect-type'
import { processCLIArgs, configure, run } from '@japa/runner'
import { BASE_URL } from '../tests_helpers/index.js'

import { BASE_URL } from '../tests/backend/helpers.js'

/*
|--------------------------------------------------------------------------
| Configure tests
|--------------------------------------------------------------------------
|
| The configure method accepts the configuration to configure the Japa
| tests runner.
|
| The first method call "processCLIArgs" process the command line arguments
| and turns them into a config object. Using this method is not mandatory.
|
| Please consult japa.dev/runner-config for the config docs.
*/
processCLIArgs(process.argv.slice(2))
configure({
files: ['tests/**/*.spec.ts'],
plugins: [
assert(),
fileSystem({
autoClean: true,
basePath: BASE_URL,
}),
expectTypeOf(),
],
plugins: [assert(), fileSystem({ basePath: BASE_URL }), snapshot()],
})

/*
|--------------------------------------------------------------------------
| Run tests
|--------------------------------------------------------------------------
|
| The following "run" method is required to execute all the tests.
|
*/
run()
33 changes: 33 additions & 0 deletions configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import type Configure from '@adonisjs/core/commands/configure'

import { stubsRoot } from './stubs/main.js'

/**
Expand All @@ -24,11 +25,22 @@ export async function configure(command: Configure) {
await codemods.makeUsingStub(stubsRoot, 'vite.config.stub', {})
await codemods.makeUsingStub(stubsRoot, 'js_entrypoint.stub', {})

/**
* Update RC file
*/
await codemods.updateRcFile((rcFile) => {
rcFile.addProvider('@adonisjs/vite/vite_provider')
rcFile.addMetaFile('public/**', false)
rcFile.addAssemblerHook('onBuildStarting', '@adonisjs/vite/build_hook')
})

/**
* Add server middleware
*/
await codemods.registerMiddleware('server', [
{ path: '@adonisjs/vite/vite_middleware', position: 'after' },
])

/**
* Prompt when `install` or `--no-install` flags are
* not used
Expand All @@ -45,4 +57,25 @@ export async function configure(command: Configure) {
} else {
await codemods.listPackagesToInstall([{ name: 'vite', isDevDependency: true }])
}

/**
* Add `assetsBundler: false` to the adonisrc file
*/
const tsMorph = await import('ts-morph')
const project = await codemods.getTsMorphProject()
const adonisRcFile = project?.getSourceFile('adonisrc.ts')
const defineConfigCall = adonisRcFile
?.getDescendantsOfKind(tsMorph.SyntaxKind.CallExpression)
.find((statement) => statement.getExpression().getText() === 'defineConfig')

const configObject = defineConfigCall!
.getArguments()[0]
.asKindOrThrow(tsMorph.SyntaxKind.ObjectLiteralExpression)

configObject.addPropertyAssignment({
name: 'assetsBundler',
initializer: 'false',
})

await adonisRcFile?.save()
}
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

export { Vite } from './src/vite.js'
export { configure } from './configure.js'
export { Vite } from './src/backend/vite.js'
export { stubsRoot } from './stubs/main.js'
export { defineConfig } from './src/backend/define_config.js'
export { defineConfig } from './src/define_config.js'
125 changes: 63 additions & 62 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,91 +1,86 @@
{
"name": "@adonisjs/vite",
"description": "Vite plugin for Adonis.js",
"version": "2.0.2",
"description": "Vite plugin for AdonisJS",
"version": "3.0.0-11",
"engines": {
"node": ">=18.16.0"
"node": ">=20.6.0"
},
"main": "build/index.js",
"type": "module",
"files": [
"build/configure.js",
"build/configure.d.ts",
"build/index.js",
"build/index.d.ts",
"build/stubs",
"build/src",
"build/services",
"build/providers"
"build",
"!build/bin",
"!build/tests",
"!build/tests_helpers"
],
"exports": {
".": "./build/index.js",
"./services/main": "./build/services/vite.js",
"./vite_provider": "./build/providers/vite_provider.js",
"./plugins/edge": "./build/src/plugins/edge.js",
"./vite_middleware": "./build/src/vite_middleware.js",
"./build_hook": "./build/src/hooks/build_hook.js",
"./services/main": "./build/services/vite.js",
"./client": "./build/src/client/main.js",
"./plugins/edge": "./build/backend/plugins/edge.js",
"./types": "./build/src/backend/types.js"
"./types": "./build/src/types.js"
},
"scripts": {
"clean": "del-cli build",
"copy:templates": "copyfiles \"stubs/**/*.stub\" build",
"copy:templates": "copyfiles --up 1 \"stubs/**/*.stub\" build",
"typecheck": "tsc --noEmit",
"lint": "eslint . --ext=.ts",
"format": "prettier --write .",
"quick:test": "node --enable-source-maps --loader=ts-node/esm bin/test.ts",
"pretest": "npm run lint",
"test": "c8 npm run quick:test",
"precompile": "npm run lint && npm run clean ",
"compile": "tsc",
"postcompile": "npm run copy:templates",
"build": "npm run compile",
"prebuild": "npm run lint && npm run clean",
"build": "tsup-node && tsc --emitDeclarationOnly --declaration",
"postbuild": "npm run copy:templates",
"release": "np",
"version": "npm run build",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@adonisjs/assembler": "^7.1.0",
"@adonisjs/core": "^6.2.1",
"@adonisjs/eslint-config": "^1.2.1",
"@adonisjs/prettier-config": "^1.2.1",
"@adonisjs/session": "^7.1.1",
"@adonisjs/shield": "^8.1.0",
"@adonisjs/tsconfig": "^1.2.1",
"@commitlint/cli": "^18.5.0",
"@commitlint/config-conventional": "^18.5.0",
"@japa/assert": "^2.1.0",
"@japa/expect-type": "^2.0.1",
"@japa/file-system": "^2.2.0",
"@japa/runner": "^3.1.1",
"@swc/core": "^1.3.105",
"@types/node": "^20.11.5",
"@adonisjs/assembler": "^7.7.0",
"@adonisjs/core": "6.9.1",
"@adonisjs/eslint-config": "^1.3.0",
"@adonisjs/prettier-config": "^1.3.0",
"@adonisjs/session": "^7.4.0",
"@adonisjs/shield": "^8.1.1",
"@adonisjs/tsconfig": "^1.3.0",
"@japa/assert": "3.0.0",
"@japa/file-system": "^2.3.0",
"@japa/runner": "3.1.4",
"@japa/snapshot": "^2.0.5",
"@swc/core": "^1.5.24",
"@types/node": "^20.13.0",
"@types/supertest": "^6.0.2",
"c8": "^9.1.0",
"copyfiles": "^2.4.1",
"del-cli": "^5.1.0",
"edge.js": "^6.0.1",
"eslint": "^8.56.0",
"husky": "^8.0.3",
"np": "^9.2.0",
"prettier": "^3.2.4",
"rollup": "^4.9.6",
"edge.js": "^6.0.2",
"eslint": "^8.57.0",
"np": "^10.0.5",
"prettier": "^3.3.0",
"supertest": "^6.3.4",
"ts-morph": "^22.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vite": "^5.0.12"
"tsup": "^8.0.2",
"typescript": "~5.4.5",
"vite": "^5.2.12"
},
"dependencies": {
"defu": "^6.1.4",
"@poppinss/utils": "^6.7.3",
"@vavite/multibuild": "^4.1.1",
"edge-error": "^4.0.1",
"vite-plugin-restart": "^0.4.0"
},
"peerDependencies": {
"@adonisjs/core": "^6.2.0",
"@adonisjs/core": "^6.3.0",
"@adonisjs/shield": "^8.0.0",
"edge.js": "^6.0.1",
"vite": "^5.0.11"
"vite": "^5.1.4"
},
"peerDependenciesMeta": {
"vite": {
"optional": true
},
"edge.js": {
"optional": true
},
Expand All @@ -107,27 +102,18 @@
"vite",
"adonisjs"
],
"contributors": [
"virk",
"adonisjs"
],
"eslintConfig": {
"extends": "@adonisjs/eslint-config/package"
},
"prettier": "@adonisjs/prettier-config",
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"publishConfig": {
"access": "public",
"tag": "latest"
"tag": "next"
},
"np": {
"message": "chore(release): %s",
"tag": "latest",
"branch": "main",
"tag": "next",
"branch": "next",
"anyBranch": false
},
"c8": {
Expand All @@ -140,7 +126,22 @@
"tests_helpers/**"
]
},
"directories": {
"test": "tests"
"tsup": {
"entry": [
"./src/hooks/build_hook.ts",
"./providers/vite_provider.ts",
"./src/vite_middleware.ts",
"./src/plugins/edge.ts",
"./src/client/main.ts",
"./services/vite.ts",
"./src/types.ts",
"./index.ts"
],
"outDir": "./build",
"clean": true,
"format": "esm",
"dts": false,
"sourcemap": true,
"target": "esnext"
}
}
Loading