proscenium 0.4.2-arm64-darwin → 0.5.1-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/channels/proscenium/connection.rb +2 -0
- data/app/channels/proscenium/reload_channel.rb +2 -0
- data/bin/esbuild +0 -0
- data/bin/lightningcss +0 -0
- data/config/routes.rb +2 -0
- data/lib/proscenium/compilers/esbuild/compile_error.js +1 -0
- data/lib/proscenium/compilers/esbuild/css/postcss.js +2 -2
- data/lib/proscenium/compilers/esbuild/resolve_plugin.js +66 -9
- data/lib/proscenium/compilers/esbuild.js +10 -3
- data/lib/proscenium/link_to_helper.rb +0 -9
- data/lib/proscenium/middleware/url.rb +21 -0
- data/lib/proscenium/middleware.rb +2 -0
- data/lib/proscenium/phlex.rb +3 -3
- data/lib/proscenium/railtie.rb +1 -0
- data/lib/proscenium/side_load.rb +2 -0
- data/lib/proscenium/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdb9396daf1d49bf6e967f21fc835cbaecb5e8ce8b11c791b2a3c965f8b64e0f
|
4
|
+
data.tar.gz: a7093def0fd1dea81d1b86ce9b54491e1669e74a1ac1923ff95d2acbcce24e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dec5e37a5fed831e2b6e300fc7c4449197e138bb239c51cf3dc7b6fa8dfa5fe139fa17f800ac6c3023ec63c8a14eb5f1c8ad9738eb6db8fae6bd81164cd7cf0b
|
7
|
+
data.tar.gz: 914124903b064f0a17f904ad74e6f87bd45955981436253b4543fc01c1717fa56d2a53582f1b1ce377d57aa23f2d0e9ce8ab75e0c65675a84c4683ca27ca2fc6
|
data/bin/esbuild
CHANGED
Binary file
|
data/bin/lightningcss
CHANGED
Binary file
|
data/config/routes.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { expandGlob } from 'std/fs/mod.ts'
|
2
|
-
import postcss
|
2
|
+
import postcss from 'postcss'
|
3
3
|
|
4
4
|
export default async (root, path) => {
|
5
5
|
let tmpFile
|
6
6
|
let contents
|
7
7
|
|
8
8
|
const mixinFiles = []
|
9
|
-
for await (const file of expandGlob(
|
9
|
+
for await (const file of expandGlob('lib/**/*.mixin.css', { root, globstar: true })) {
|
10
10
|
mixinFiles.push(file.path)
|
11
11
|
}
|
12
12
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { join, resolve } from 'std/path/mod.ts'
|
2
2
|
import { resolve as resolveFromImportMap } from 'import-maps/resolve'
|
3
|
+
import { cache } from 'cache'
|
3
4
|
|
4
5
|
import setup from './setup_plugin.js'
|
5
6
|
|
@@ -15,6 +16,45 @@ export default setup('resolve', (build, options) => {
|
|
15
16
|
const isProd = env === 'production'
|
16
17
|
|
17
18
|
return [
|
19
|
+
{
|
20
|
+
// Filters for imports starting with `url:http://` or `url:https://`; returning the path
|
21
|
+
// without the `url:` prefix, and a namespace of 'url`
|
22
|
+
type: 'onResolve',
|
23
|
+
filter: /^url:https?:\/\//,
|
24
|
+
callback(args) {
|
25
|
+
return {
|
26
|
+
path: args.path.slice(4),
|
27
|
+
namespace: 'url'
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
|
32
|
+
{
|
33
|
+
type: 'onResolve',
|
34
|
+
filter: /.*/,
|
35
|
+
namespace: 'url',
|
36
|
+
callback(args) {
|
37
|
+
if (!isBareModule(args.path)) {
|
38
|
+
return {
|
39
|
+
path: new URL(args.path, args.importer).toString(),
|
40
|
+
namespace: 'url'
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
},
|
45
|
+
|
46
|
+
{
|
47
|
+
type: 'onLoad',
|
48
|
+
filter: /.*/,
|
49
|
+
namespace: 'url',
|
50
|
+
async callback(args) {
|
51
|
+
const file = await cache(args.path)
|
52
|
+
const contents = await Deno.readTextFile(file.path)
|
53
|
+
|
54
|
+
return { contents }
|
55
|
+
}
|
56
|
+
},
|
57
|
+
|
18
58
|
{
|
19
59
|
type: 'onResolve',
|
20
60
|
filter: /.*/,
|
@@ -28,9 +68,13 @@ export default setup('resolve', (build, options) => {
|
|
28
68
|
args.suffix = `?${options.cacheQueryString}`
|
29
69
|
}
|
30
70
|
|
31
|
-
// Mark remote modules as external.
|
32
|
-
|
33
|
-
|
71
|
+
// Mark remote modules as external. If not css, then the path is prefixed with "url:", which
|
72
|
+
// is then handled by the Url Middleware.
|
73
|
+
if (
|
74
|
+
!args.importer.endsWith('.css') &&
|
75
|
+
(args.path.startsWith('http://') || args.path.startsWith('https://'))
|
76
|
+
) {
|
77
|
+
return { path: `/url:${encodeURIComponent(args.path)}`, external: true }
|
34
78
|
}
|
35
79
|
|
36
80
|
// Rewrite the path to the actual runtime directory.
|
@@ -56,14 +100,24 @@ export default setup('resolve', (build, options) => {
|
|
56
100
|
const result = { path: params.path, suffix: params.suffix }
|
57
101
|
|
58
102
|
if (importMap) {
|
59
|
-
|
103
|
+
let baseURL
|
104
|
+
if (params.importer.startsWith('https://') || params.importer.startsWith('http://')) {
|
105
|
+
baseURL = new URL(params.importer)
|
106
|
+
} else {
|
107
|
+
baseURL = new URL(params.importer.slice(cwd.length), 'file://')
|
108
|
+
}
|
109
|
+
|
60
110
|
const { matched, resolvedImport } = resolveFromImportMap(params.path, importMap, baseURL)
|
61
111
|
|
62
112
|
if (matched) {
|
63
113
|
if (resolvedImport.protocol === 'file:') {
|
64
114
|
params.path = resolvedImport.pathname
|
65
115
|
} else {
|
66
|
-
|
116
|
+
if (params.importer.endsWith('.css')) {
|
117
|
+
return { path: resolvedImport.href, external: true }
|
118
|
+
}
|
119
|
+
|
120
|
+
return { path: `/url:${encodeURIComponent(resolvedImport.href)}`, external: true }
|
67
121
|
}
|
68
122
|
}
|
69
123
|
}
|
@@ -73,9 +127,7 @@ export default setup('resolve', (build, options) => {
|
|
73
127
|
result.path = resolve(cwd, params.path.slice(1))
|
74
128
|
}
|
75
129
|
|
76
|
-
|
77
|
-
// and extension-less paths without custom code, as esbuild with resolve them for us.
|
78
|
-
const resolveResult = await build.resolve(result.path, {
|
130
|
+
const resOptions = {
|
79
131
|
// If path is a bare module (node_modules), and resolveDir is the Proscenium runtime dir, or
|
80
132
|
// is the current working dir, then use `cwd` as the `resolveDir`, otherwise pass it through
|
81
133
|
// as is. This ensures that nested node_modules are resolved correctly.
|
@@ -84,11 +136,16 @@ export default setup('resolve', (build, options) => {
|
|
84
136
|
(!params.resolveDir.startsWith(cwd) || params.resolveDir.startsWith(runtimeDir))
|
85
137
|
? cwd
|
86
138
|
: params.resolveDir,
|
139
|
+
kind: params.kind,
|
87
140
|
pluginData: {
|
88
141
|
// We use this property later on, as we should ignore this resolution call.
|
89
142
|
isResolvingPath: true
|
90
143
|
}
|
91
|
-
}
|
144
|
+
}
|
145
|
+
|
146
|
+
// Resolve the path using esbuild's internal resolution. This allows us to import node packages
|
147
|
+
// and extension-less paths without custom code, as esbuild with resolve them for us.
|
148
|
+
const resolveResult = await build.resolve(result.path, resOptions)
|
92
149
|
|
93
150
|
// Simple return the resolved result if we have an error. Usually happens when module is not
|
94
151
|
// found.
|
@@ -92,9 +92,10 @@ async function main(paths = [], options = {}) {
|
|
92
92
|
for await (const file of expandGlob(path, { root })) {
|
93
93
|
file.isFile && entryPoints.add(file.path)
|
94
94
|
}
|
95
|
-
} else if (path.startsWith('/')) {
|
96
|
-
// Path is absolute, so it must be outsideRoot. Don't
|
97
|
-
//
|
95
|
+
} else if (path.startsWith('/') || /^url:https?:\/\//.test(path)) {
|
96
|
+
// Path is absolute, or is prefixed with 'url:', so it must be outsideRoot, or Url. Don't
|
97
|
+
// prefix the root.
|
98
|
+
// See Proscenium::Middleware::[OutsideRoot|Url].
|
98
99
|
entryPoints.add(path)
|
99
100
|
} else {
|
100
101
|
entryPoints.add(join(root, path))
|
@@ -128,6 +129,12 @@ async function main(paths = [], options = {}) {
|
|
128
129
|
jsxDev: !isTest && !isProd,
|
129
130
|
minify: isProd,
|
130
131
|
bundle: true,
|
132
|
+
|
133
|
+
// The Esbuild default places browser before module, but we're building for modern browsers
|
134
|
+
// which support esm. So we prioritise that. Some libraries export a "browser" build that still
|
135
|
+
// uses CJS.
|
136
|
+
mainFields: ['module', 'browser', 'main'],
|
137
|
+
|
131
138
|
plugins: [
|
132
139
|
envPlugin(),
|
133
140
|
resolvePlugin({ runtimeDir, importMap, debug, cacheQueryString: options.cacheQueryString }),
|
@@ -10,15 +10,6 @@ module Proscenium
|
|
10
10
|
# link_to 'Go to', MyComponent
|
11
11
|
#
|
12
12
|
# TODO: ummm, todo it! ;)
|
13
|
-
def link_to(*args, &block)
|
14
|
-
# name_argument_index = block ? 0 : 1
|
15
|
-
# if (args[name_argument_index]).respond_to?(:render_in)
|
16
|
-
# return super(*LinkToComponentArguments.new(args, name_argument_index,
|
17
|
-
# self).helper_options, &block)
|
18
|
-
# end
|
19
|
-
|
20
|
-
super
|
21
|
-
end
|
22
13
|
end
|
23
14
|
|
24
15
|
# Component handling for the `link_to` helper.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Proscenium
|
4
|
+
class Middleware
|
5
|
+
# Handles requests prefixed with "url:https://"; downloading, caching, and compiling them.
|
6
|
+
class Url < Esbuild
|
7
|
+
private
|
8
|
+
|
9
|
+
# @override [Esbuild] It's a URL, so always assume it is renderable (we won't actually know
|
10
|
+
# until it's downloaded).
|
11
|
+
def renderable?
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
# @override [Esbuild]
|
16
|
+
def path
|
17
|
+
CGI.unescape(@request.path)[1..]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -10,6 +10,7 @@ module Proscenium
|
|
10
10
|
autoload :Base
|
11
11
|
autoload :Esbuild
|
12
12
|
autoload :Runtime
|
13
|
+
autoload :Url
|
13
14
|
autoload :OutsideRoot
|
14
15
|
|
15
16
|
def initialize(app)
|
@@ -45,6 +46,7 @@ module Proscenium
|
|
45
46
|
return OutsideRoot if path.fnmatch?(glob_types[:outsideRoot], File::FNM_EXTGLOB)
|
46
47
|
end
|
47
48
|
|
49
|
+
return Url if request.path.match?(glob_types[:url])
|
48
50
|
return Runtime if path.fnmatch?(glob_types[:runtime], File::FNM_EXTGLOB)
|
49
51
|
return Esbuild if path.fnmatch?(glob_types[:esbuild], File::FNM_EXTGLOB)
|
50
52
|
end
|
data/lib/proscenium/phlex.rb
CHANGED
@@ -11,9 +11,9 @@ module Proscenium
|
|
11
11
|
|
12
12
|
module Helpers
|
13
13
|
def side_load_javascripts(...)
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
return unless (output = @_view_context.side_load_javascripts(...))
|
15
|
+
|
16
|
+
@_target << output
|
17
17
|
end
|
18
18
|
|
19
19
|
%i[side_load_stylesheets proscenium_dev].each do |name|
|
data/lib/proscenium/railtie.rb
CHANGED
data/lib/proscenium/side_load.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
3
4
|
module Proscenium
|
4
5
|
module SideLoad
|
5
6
|
DEFAULT_EXTENSIONS = %i[js css].freeze
|
@@ -68,3 +69,4 @@ module Proscenium
|
|
68
69
|
end
|
69
70
|
end
|
70
71
|
end
|
72
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
data/lib/proscenium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proscenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- Joel Moss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actioncable
|
@@ -132,14 +132,14 @@ dependencies:
|
|
132
132
|
requirements:
|
133
133
|
- - "~>"
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
135
|
+
version: 2.74.1
|
136
136
|
type: :runtime
|
137
137
|
prerelease: false
|
138
138
|
version_requirements: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
140
|
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
142
|
+
version: 2.74.1
|
143
143
|
description:
|
144
144
|
email:
|
145
145
|
- joel@developwithstyle.com
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- lib/proscenium/middleware/outside_root.rb
|
183
183
|
- lib/proscenium/middleware/runtime.rb
|
184
184
|
- lib/proscenium/middleware/static.rb
|
185
|
+
- lib/proscenium/middleware/url.rb
|
185
186
|
- lib/proscenium/phlex.rb
|
186
187
|
- lib/proscenium/phlex/component.rb
|
187
188
|
- lib/proscenium/phlex/react_component.rb
|