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

Integrate Vite & Rework Mix #1141

Merged
merged 63 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
eb3573f
Initial wip
jaxwilko May 31, 2024
989f1cf
Switched implementation to use PackageJson
jaxwilko Jun 5, 2024
5743fbb
Added fix for packages being resolved as an object in json
jaxwilko Jun 5, 2024
d6a15ce
Added vite function to twig
jaxwilko Jun 5, 2024
c847c1a
Added vite commands, renamed old commands and added abstraction
jaxwilko Jun 5, 2024
c373d9a
Added vite config stubs
jaxwilko Jun 5, 2024
ea92c49
Added laravel plugin to install list
jaxwilko Jun 5, 2024
0eaa431
Added fix for eslint parsing fixtures
jaxwilko Jun 5, 2024
5d53b4d
Added fix for undefined keys
jaxwilko Jun 5, 2024
96f1bc6
Revert workflow change
jaxwilko Jun 5, 2024
bf96f7f
Added comment and return type
jaxwilko Jun 5, 2024
1e4ff21
Added comments and small tweaks
jaxwilko Jun 5, 2024
08cca0c
Apply suggestions from code review
jaxwilko Jun 5, 2024
e35a1a0
Added common aliases
jaxwilko Jun 6, 2024
914de7d
Merge branch 'wip/vite-mix-v2' of github.com:wintercms/winter into wi…
jaxwilko Jun 6, 2024
eacd3c2
Remove duplicated type information
LukeTowers Jun 6, 2024
eb95c3c
Apply suggestions from code review
LukeTowers Jun 6, 2024
1500557
Added reordered params and script handling for PackageJson
jaxwilko Jun 7, 2024
6b2b30e
Added fix for getPackage returning incorrect package config
jaxwilko Jun 7, 2024
4a2151e
Added fix for checking package registered
jaxwilko Jun 7, 2024
5aa3248
Added fixes for mix:compile with incorrect config paths
jaxwilko Jun 7, 2024
97576c6
Added Vite unit test
jaxwilko Jun 7, 2024
3a98a96
Added eslint ignores
jaxwilko Jun 7, 2024
8a696dc
Added fix to enable passing package name to vite twig function
jaxwilko Jun 9, 2024
ec7680b
Added default to .mjs file to fix module conflict
jaxwilko Jun 11, 2024
0eb0a99
Updated fixtures and added css stubs
jaxwilko Jun 11, 2024
3f5bbca
Added support for setting up default stub files
jaxwilko Jun 11, 2024
bf954fc
Added postcss config when setting up tailwind config
jaxwilko Jun 11, 2024
c3f8099
Apply suggestions from code review
jaxwilko Jun 11, 2024
d55b517
Added helper for generating vite tags
jaxwilko Jun 11, 2024
0568b54
Merge
jaxwilko Jun 11, 2024
d46a830
Added config tests
jaxwilko Jul 3, 2024
5f50119
Added fix for namespace
jaxwilko Jul 3, 2024
d82978a
Added refactor to use artisan helper
jaxwilko Jul 3, 2024
11ca249
Merge branch 'develop' into wip/vite-mix-v2
jaxwilko Jul 3, 2024
647f285
Added fix for unset position
jaxwilko Jul 5, 2024
744245b
Added support for --disable-tty
jaxwilko Jul 5, 2024
8a18c9b
Added support for --disable-tty to vite commands
jaxwilko Jul 5, 2024
2c3f3a5
Added tests
jaxwilko Jul 5, 2024
e5e2cc1
Cleaned up test with artisan command
jaxwilko Jul 5, 2024
8bd7043
Added confirmation for overriding configured package
jaxwilko Jul 10, 2024
c708a01
Added blocks to vite config refresh paths
jaxwilko Jul 10, 2024
d02926c
Added extra tests and fixes for PackageJson
jaxwilko Jul 11, 2024
ba8cadc
Added metapackage list and added js stubs
jaxwilko Jul 11, 2024
78de514
Added js/css inputs as default for all configs
jaxwilko Jul 11, 2024
3c5d45a
Added compile on exit for vite watch
jaxwilko Jul 11, 2024
c55bb79
Added export-ignore for package.json
jaxwilko Jul 11, 2024
e2a8da0
Added fix for mixed case package names coming from PluginManager
jaxwilko Jul 11, 2024
25d3c43
Added addVite() method to AssetMaker
jaxwilko Jul 11, 2024
49962d6
Added fix so mix & vite stub paths match
jaxwilko Jul 11, 2024
f5626be
Added fix for incorrect signature in npm:run
jaxwilko Jul 12, 2024
41eaffb
Added vite asset render to twig scripts tag
jaxwilko Jul 12, 2024
fd27f1b
Update modules/system/classes/CompilableAssets.php
LukeTowers Jul 14, 2024
be4e50f
Update modules/system/classes/PackageJson.php
LukeTowers Jul 14, 2024
f55d171
Update modules/system/console/asset/AssetConfig.php
LukeTowers Jul 14, 2024
c3fadc0
Added registration method name generation
jaxwilko Jul 14, 2024
6aa24cc
Merge branch 'wip/vite-mix-v2' of github.com:wintercms/winter into wi…
jaxwilko Jul 14, 2024
1d9257e
Update modules/cms/twig/Extension.php
jaxwilko Jul 14, 2024
2905f62
Swapped exception
jaxwilko Jul 14, 2024
6409346
Added fix for incorrect error message
jaxwilko Jul 14, 2024
287dae5
Swapped exception
jaxwilko Jul 14, 2024
72f1e29
Removed auto populate of config on install without config
jaxwilko Jul 14, 2024
9b252d6
Merge branch 'develop' into wip/vite-mix-v2
jaxwilko Jul 14, 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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
.gitattributes export-ignore
.gitpod.yml export-ignore
CHANGELOG.md export-ignore
/package.json export-ignore
LukeTowers marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 14 additions & 1 deletion modules/cms/twig/Extension.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php namespace Cms\Twig;

use Block;
use Cms\Classes\Controller;
use Event;
use System\Classes\Vite;
use Twig\Extension\AbstractExtension as TwigExtension;
use Twig\TwigFilter as TwigSimpleFilter;
use Twig\TwigFunction as TwigSimpleFunction;
use Cms\Classes\Controller;

/**
* The CMS Twig extension class implements the basic CMS Twig functions and filters.
Expand Down Expand Up @@ -51,6 +52,7 @@ public function getFunctions(): array
new TwigSimpleFunction('content', [$this, 'contentFunction'], $options),
new TwigSimpleFunction('component', [$this, 'componentFunction'], $options),
new TwigSimpleFunction('placeholder', [$this, 'placeholderFunction'], ['is_safe' => ['html']]),
new TwigSimpleFunction('vite', [$this, 'viteFunction'], $options),
];
}

Expand Down Expand Up @@ -166,6 +168,17 @@ public function themeFilter($url): string
return $this->controller->themeUrl($url);
}

/**
* Generates Vite tags via Laravel's Vite Object.
*
* @param array $entrypoints The list of entry points for Vite
* @param string $package The package name of the plugin or theme
jaxwilko marked this conversation as resolved.
Show resolved Hide resolved
*/
public function viteFunction(array $entrypoints, string $package): \Illuminate\Support\HtmlString
{
return Vite::tags($entrypoints, $package);
}

/**
* Opens a layout block.
*/
Expand Down
1 change: 1 addition & 0 deletions modules/cms/twig/ScriptsNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function compile(TwigCompiler $compiler)
$compiler
->addDebugInfo($this)
->write("echo \$this->env->getExtension('Cms\Twig\Extension')->assetsFunction('js');\n")
->write("echo \$this->env->getExtension('Cms\Twig\Extension')->assetsFunction('vite');\n")
->write("echo \$this->env->getExtension('Cms\Twig\Extension')->displayBlock('scripts');\n")
;
}
Expand Down
2 changes: 2 additions & 0 deletions modules/system/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ assets/vendor

# Ignore test fixtures
tests/js
tests/fixtures/themes/test/assets/js
tests/fixtures/themes/vitetest/assets/javascript
24 changes: 18 additions & 6 deletions modules/system/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Config;
use DateInterval;
use Event;
use Illuminate\Foundation\Vite;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;
use Markdown;
Expand Down Expand Up @@ -142,6 +143,9 @@ protected function registerSingletons()
$this->app->singleton('backend.auth', function () {
return \Backend\Classes\AuthManager::instance();
});

// Register the Laravel Vite singleton
$this->app->singleton(Vite::class, \System\Classes\Vite::class);
}

/**
Expand Down Expand Up @@ -316,12 +320,20 @@ protected function registerConsole()
$this->registerConsoleCommand('plugin.rollback', \System\Console\PluginRollback::class);
$this->registerConsoleCommand('plugin.list', \System\Console\PluginList::class);

$this->registerConsoleCommand('mix.install', \System\Console\MixInstall::class);
$this->registerConsoleCommand('mix.update', \System\Console\MixUpdate::class);
$this->registerConsoleCommand('mix.list', \System\Console\MixList::class);
$this->registerConsoleCommand('mix.compile', \System\Console\MixCompile::class);
$this->registerConsoleCommand('mix.watch', \System\Console\MixWatch::class);
$this->registerConsoleCommand('mix.run', \System\Console\MixRun::class);
$this->registerConsoleCommand('mix.compile', Console\Asset\Mix\MixCompile::class);
$this->registerConsoleCommand('mix.config', Console\Asset\Mix\MixConfig::class);
$this->registerConsoleCommand('mix.install', Console\Asset\Mix\MixInstall::class);
$this->registerConsoleCommand('mix.list', Console\Asset\Mix\MixList::class);
$this->registerConsoleCommand('mix.watch', Console\Asset\Mix\MixWatch::class);

$this->registerConsoleCommand('vite.compile', Console\Asset\Vite\ViteCompile::class);
$this->registerConsoleCommand('vite.config', Console\Asset\Vite\ViteConfig::class);
$this->registerConsoleCommand('vite.install', Console\Asset\Vite\ViteInstall::class);
$this->registerConsoleCommand('vite.list', Console\Asset\Vite\ViteList::class);
$this->registerConsoleCommand('vite.watch', Console\Asset\Vite\ViteWatch::class);

$this->registerConsoleCommand('npm.run', Console\NpmRun::class);
$this->registerConsoleCommand('npm.update', Console\NpmUpdate::class);
}

/*
Expand Down
Loading
Loading