proscenium 0.1.0.alpha4-arm64-darwin → 0.1.2-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ac83bfca343680535bf4f188a9e74db2848752cda2708f323a175215d508a1c
4
- data.tar.gz: ba7d653af25382437e4aa3870f5be2f02731da51828080c01eddcdb370f58de9
3
+ metadata.gz: d20f6189b8ed53c8f8c49fdd34ff7c94e9dd664e4a270d0f19300ce2435868b2
4
+ data.tar.gz: 19ca20f0dc49a00ccacddc79459cfa1f9676f3d89d5f276a8c1b9c27637f2212
5
5
  SHA512:
6
- metadata.gz: f1ee7d5ca80dd3ada1436934df8302cbb091e0eca24f9be66417b529a47a574edd46bae4e3b00a643f0eeab0af80a72d2fdebd174b2403aab56de59df4ccb02b
7
- data.tar.gz: 686685bd60968269a7e286a965f7aeab153e5202136d881f875586f8c64eade642e51f405b4d1a92a88be04dea85e7ba3d07b94900ce582cd8d3372bbea16c65
6
+ metadata.gz: 2703a824ce1acc0e8aa972012fe275b881d8946ff63c8498f8b52de64229faeadc4008e00acb960078c5c9c3d8c02b0219ddaeb75f0b7479f529e7f34495e12a
7
+ data.tar.gz: fa206820113a895af26afa184c88045a62ac307e83eaf7337c9feaff202f2d4ac01d16de9b19378f162397bb839f6ca268b0429ec515a39d21899b34b706a8a5
data/bin/esbuild CHANGED
Binary file
@@ -1,6 +1,8 @@
1
1
  export default class ArgumentError extends Error {
2
2
  static MESSAGES = {
3
3
  rootRequired: 'Current working directory is required as --root.',
4
+ lightningcssBinRequired:
5
+ 'Path to the lightningcss CLI binary is required as --lightningcss-bin.',
4
6
  pathsRequired: 'One or more file paths or globs are required.',
5
7
 
6
8
  rootUnknown: ({ root }) => `A valid working directory is required - received ${root}`
@@ -1,16 +1,12 @@
1
1
  import { crypto } from 'std/crypto/mod.ts'
2
- import { join, resolve, dirname, basename, fromFileUrl } from 'std/path/mod.ts'
2
+ import { join, dirname, basename } from 'std/path/mod.ts'
3
3
 
4
4
  import { fileExists } from '../../utils.js'
5
5
  import postcss from './css/postcss.js'
6
6
  import setup from './setup_plugin.js'
7
7
 
8
- export default setup('css', async build => {
8
+ export default setup('css', async (build, options) => {
9
9
  const cwd = build.initialOptions.absWorkingDir
10
- const lightningcssBin = resolve(
11
- dirname(fromFileUrl(import.meta.url)),
12
- '../../../../bin/lightningcss'
13
- )
14
10
 
15
11
  let customMedia
16
12
  try {
@@ -40,7 +36,7 @@ export default setup('css', async build => {
40
36
  }
41
37
 
42
38
  let cmd = [
43
- lightningcssBin,
39
+ options.lightningcssBin,
44
40
  '--nesting',
45
41
  '--error-recovery',
46
42
  args.pluginData?.importedFromJs && '--minify',
@@ -31,6 +31,8 @@ import throwCompileError from './esbuild/compile_error.js'
31
31
  * take place.
32
32
  * --import-map
33
33
  * Path to an import map, relative to the <root>.
34
+ * --lightningcss-bin
35
+ * Path to the lightningcss CLI binary.
34
36
  * --write
35
37
  * Write output to the filesystem according to esbuild logic.
36
38
  * --debug
@@ -40,10 +42,11 @@ if (import.meta.main) {
40
42
  !Deno.env.get('RAILS_ENV') && Deno.env.set('RAILS_ENV', 'development')
41
43
 
42
44
  const { _: paths, ...options } = parseArgs(Deno.args, {
43
- string: ['root', 'import-map'],
45
+ string: ['root', 'import-map', 'lightningcss-bin'],
44
46
  boolean: ['write', 'debug'],
45
47
  alias: {
46
- 'import-map': 'importMap'
48
+ 'import-map': 'importMap',
49
+ 'lightningcss-bin': 'lightningcssBin'
47
50
  }
48
51
  })
49
52
 
@@ -62,6 +65,7 @@ async function main(paths = [], options = {}) {
62
65
 
63
66
  if (!Array.isArray(paths) || paths.length < 1) throw new ArgumentError('pathsRequired')
64
67
  if (!options.root) throw new ArgumentError('rootRequired')
68
+ if (!options.lightningcssBin) throw new ArgumentError('lightningcssBinRequired')
65
69
 
66
70
  const root = resolve(options.root)
67
71
 
@@ -117,13 +121,17 @@ async function main(paths = [], options = {}) {
117
121
  jsxDev: !isTest && !isProd,
118
122
  minify: isProd,
119
123
  bundle: true,
120
- plugins: [envPlugin(), resolvePlugin({ runtimeDir, importMap, debug }), cssPlugin({ debug })],
124
+ plugins: [
125
+ envPlugin(),
126
+ resolvePlugin({ runtimeDir, importMap, debug }),
127
+ cssPlugin({ lightningcssBin: options.lightningcssBin, debug })
128
+ ],
121
129
  metafile: write,
122
130
  write
123
131
  }
124
132
 
125
133
  if (!debug) {
126
- params.sourcemap = isTest ? false : isProd ? 'linked' : 'inline'
134
+ params.sourcemap = isProd || isTest ? false : 'inline'
127
135
  }
128
136
 
129
137
  let result
@@ -142,7 +150,8 @@ async function main(paths = [], options = {}) {
142
150
  if (write) {
143
151
  return new TextEncoder().encode(JSON.stringify(result))
144
152
  } else {
145
- return result.outputFiles[0].contents
153
+ const fileIndex = params.sourcemap === 'linked' ? 1 : 0
154
+ return result.outputFiles[fileIndex].contents
146
155
  }
147
156
  }
148
157
 
@@ -15,7 +15,9 @@ module Proscenium
15
15
 
16
16
  def attempt
17
17
  benchmark :esbuild do
18
- render_response build("#{cli} --root #{root} #{path}")
18
+ render_response build(
19
+ "#{cli} --root #{root} --lightningcss-bin #{lightningcss_cli} #{path}"
20
+ )
19
21
  end
20
22
  rescue CompileError => e
21
23
  render_response "export default #{e.detail.to_json}" do |response|
@@ -38,6 +40,14 @@ module Proscenium
38
40
  Gem.bin_path 'proscenium', 'esbuild'
39
41
  end
40
42
  end
43
+
44
+ def lightningcss_cli
45
+ if ENV['PROSCENIUM_TEST']
46
+ 'bin/lightningcss'
47
+ else
48
+ Gem.bin_path 'proscenium', 'lightningcss'
49
+ end
50
+ end
41
51
  end
42
52
  end
43
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Proscenium
4
- VERSION = '0.1.0.alpha4'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proscenium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.alpha4
4
+ version: 0.1.2
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Joel Moss
@@ -200,9 +200,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
200
  version: 2.7.0
201
201
  required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  requirements:
203
- - - ">"
203
+ - - ">="
204
204
  - !ruby/object:Gem::Version
205
- version: 1.3.1
205
+ version: '0'
206
206
  requirements: []
207
207
  rubygems_version: 3.3.7
208
208
  signing_key: